Changeset 1302
- Timestamp:
- 07/18/07 13:31:16 (1 year ago)
- Files:
-
- mochikit/trunk/MochiKit/DOM.js (modified) (1 diff)
- mochikit/trunk/tests/test_MochiKit-DOM.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mochikit/trunk/MochiKit/DOM.js
r1263 r1302 371 371 maybeparent = self.getElement(maybeparent); 372 372 } 373 if (node === maybeparent) { 374 return true; 375 } 376 while (node && node.tagName.toUpperCase() != "BODY") { 377 node = node.parentNode; 373 if (typeof(node) == 'undefined' || node === null || node === self._document) { 374 return false; 375 } 376 do { 378 377 if (node === maybeparent) { 379 378 return true; 380 379 } 381 } 380 var tagName = node.tagName; 381 node = node.parentNode; 382 if (!tagName) { 383 break; 384 } 385 tagName = tagName.toUpperCase(); 386 } while (tagName != "BODY" && tagName != "HTML"); 382 387 return false; 383 388 }, mochikit/trunk/tests/test_MochiKit-DOM.html
r1247 r1302 293 293 is( getFirstParentByTagAndClassName('child', '*', 'two'), getElement("parentTwo"), "getFirstParentByTagAndClassName found parent (any tag)" ); 294 294 295 ok( isChildNode('child', 'parentZero'), "isChildNode direct child"); 296 ok( isChildNode('child', 'parentTwo'), "isChildNode sub child"); 297 ok( !isChildNode('child', 'form_test'), "isChildNode wrong child"); 298 ok( !isChildNode('child', 'donotexist'), "isChildNode no parent"); 299 ok( !isChildNode('donotexist', 'child'), "isChildNode no parent"); 300 ok( isChildNode('child', document.body), "isChildNode of body"); 301 295 302 ok( true, "test suite finished!"); 296 303
