Ticket #10150: descendantOf_document_patch_test.diff
| File descendantOf_document_patch_test.diff, 1.2 kB (added by kangax, 3 months ago) |
|---|
-
test/unit/dom.html
old new 1115 1115 1116 1116 $(document.body).insert(new Element('div', { id: 'impostor' })); 1117 1117 this.assert(!$('impostor').descendantOf('ancestor')); 1118 1119 this.assert(Element.descendantOf(document.body, document)); 1120 this.assert(Element.descendantOf(document.documentElement, document)); 1121 1118 1122 }, 1119 1123 1120 1124 testChildOf: function() { -
src/dom.js
old new 372 372 var e = element.sourceIndex, a = ancestor.sourceIndex, 373 373 nextAncestor = ancestor.nextSibling; 374 374 if (!nextAncestor) { 375 do { ancestor = ancestor.parentNode; } 376 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); 375 while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode) { 376 ancestor = ancestor.parentNode; 377 } 377 378 } 378 379 if (nextAncestor && nextAncestor.sourceIndex) 379 380 return (e > a && e < nextAncestor.sourceIndex);