Changeset 1369

Show
Ignore:
Timestamp:
05/06/08 01:21:54 (3 months ago)
Author:
cederberg@gmail.com
Message:

Fixed issue with isChildNode() not correctly handling nodes outside the DOM tree (ticket #304).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • mochikit/trunk/MochiKit/DOM.js

    r1368 r1369  
    362362            return false; 
    363363        } 
    364         while (node !== self._document) { 
     364        while (node != null && node !== self._document) { 
    365365            if (node === maybeparent) { 
    366366                return true; 
  • mochikit/trunk/packed/MochiKit/MochiKit.js

    r1368 r1369  
    28472847return false; 
    28482848} 
    2849 while(node!==self._document){ 
     2849while(node!=null&&node!==self._document){ 
    28502850if(node===_310){ 
    28512851return true; 
  • mochikit/trunk/tests/test_MochiKit-DOM.html

    r1346 r1369  
    302302    ok( isChildNode('child', document.body), "isChildNode of body"); 
    303303    ok( isChildNode($('child').firstChild, 'parentTwo'), "isChildNode text node"); 
     304    ok( !isChildNode( SPAN(), document.body), "isChildNode child not in DOM"); 
     305    ok( !isChildNode( SPAN(), 'child'), "isChildNode child not in DOM"); 
     306    ok( !isChildNode( 'child', SPAN()), "isChildNode parent not in DOM"); 
    304307 
    305308    ok( true, "test suite finished!");