diff --git a/CHANGELOG b/CHANGELOG index 6a827f5..d0d68ea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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] diff --git a/src/dom.js b/src/dom.js index 4273378..e9b878c 100644 --- a/src/dom.js +++ b/src/dom.js @@ -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;