Permalink
Browse files

Fix issue where Safari improperly reports an element as a descendant …

…of itself.
  • Loading branch information...
1 parent a3f7b71 commit d13a93882cebf89bcbab6fa9fbb6f51b9b564281 @savetheclocktower savetheclocktower committed Mar 31, 2008
Showing with 3 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +1 −1 src/dom.js
View
@@ -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
@@ -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;

0 comments on commit d13a938

Please sign in to comment.