Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

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  
    11151115       
    11161116      $(document.body).insert(new Element('div', { id: 'impostor' })); 
    11171117      this.assert(!$('impostor').descendantOf('ancestor')); 
     1118       
     1119      this.assert(Element.descendantOf(document.body, document)); 
     1120      this.assert(Element.descendantOf(document.documentElement, document)); 
     1121       
    11181122    },   
    11191123     
    11201124    testChildOf: function() { 
  • src/dom.js

    old new  
    372372      var e = element.sourceIndex, a = ancestor.sourceIndex, 
    373373       nextAncestor = ancestor.nextSibling; 
    374374      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        } 
    377378      } 
    378379      if (nextAncestor && nextAncestor.sourceIndex) 
    379380       return (e > a && e < nextAncestor.sourceIndex);