* Fix a bug in the IE-specific Element#descendantOf logic. [Nicholas, Andrew Dupont]

This commit is contained in:
Andrew Dupont 2007-11-27 17:59:46 +00:00
parent 6e080aa186
commit 26b8033295
3 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,5 @@
* Fix a bug in the IE-specific Element#descendantOf logic. [Nicholas, Andrew Dupont]
* Make Ajax.Updater clone its options hash before modifying it. Prevents memory leaks in Ajax.PeriodicalUpdater. Closes #10049 [Mislav Marohnić, Tobie Langel].
* Remove useless variable in Selector.handlers.child. Closes #10006 [kuriyama]

View File

@ -359,6 +359,7 @@ Element.Methods = {
descendantOf: function(element, ancestor) {
element = $(element), ancestor = $(ancestor);
var originalAncestor = ancestor;
if (element.compareDocumentPosition)
return (element.compareDocumentPosition(ancestor) & 8) === 8;
@ -374,7 +375,7 @@ Element.Methods = {
}
while (element = element.parentNode)
if (element == ancestor) return true;
if (element == originalAncestor) return true;
return false;
},

View File

@ -1031,6 +1031,8 @@
assert(!$('sibling').descendantOf('child'), 'sibling < child');
assert(!$('great-grand-child').descendantOf('not-in-the-family'), 'great-grand-child < not-in-the-family');
assert(!$('child').descendantOf('not-in-the-family'), 'child < not-in-the-family');
assert(!$(document.body).descendantOf('great-grand-child'));
}},
testChildOf: function() {with(this) {