Simplify Item#isAncestor() by formulating it as the reverse of Item#isDescendant().

This commit is contained in:
Jürg Lehni 2011-05-28 21:09:03 +01:00
parent 6aac2b3e67
commit 3c2977287a

View file

@ -669,12 +669,7 @@ var Item = this.Item = Base.extend({
* item} * item}
*/ */
isAncestor: function(item) { isAncestor: function(item) {
var parent = item; return item ? item.isDescendant(this) : false;
while (parent = parent._parent) {
if (parent == this)
return true;
}
return false;
}, },
/** /**