From 3c2977287a12fa362eab9b650621c69c4e0ad9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 28 May 2011 21:09:03 +0100 Subject: [PATCH] Simplify Item#isAncestor() by formulating it as the reverse of Item#isDescendant(). --- src/item/Item.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/item/Item.js b/src/item/Item.js index fd2f7bc9..b102de25 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -669,12 +669,7 @@ var Item = this.Item = Base.extend({ * item} */ isAncestor: function(item) { - var parent = item; - while (parent = parent._parent) { - if (parent == this) - return true; - } - return false; + return item ? item.isDescendant(this) : false; }, /**