Fix issue where Safari improperly reports an element as a descendant of itself.

This commit is contained in:
Andrew Dupont 2008-03-30 21:02:47 -05:00
parent a3f7b712c3
commit d13a93882c
2 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Fix issue where Safari improperly reports an element as a descendant of itself.
* Greatly simplify IE's implementation of Element#descendantOf.
* Prevent exception when using Selector to search for an attribute that is not present. [gryn, Andrew Dupont]

View File

@ -368,7 +368,7 @@ Element.Methods = {
return (element.compareDocumentPosition(ancestor) & 8) === 8;
if (ancestor.contains)
return ancestor.contains(element);
return ancestor.contains(element) && ancestor !== element;
while (element = element.parentNode)
if (element == ancestor) return true;