Node-parentNode.html (1009B)
1 <!DOCTYPE html> 2 <title>Node.parentNode</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id="log"></div> 6 <script> 7 // XXX need to test for more node types 8 test(function() { 9 assert_equals(document.parentNode, null) 10 }, "Document") 11 test(function() { 12 assert_equals(document.doctype.parentNode, document) 13 }, "Doctype") 14 test(function() { 15 assert_equals(document.documentElement.parentNode, document) 16 }, "Root element") 17 test(function() { 18 var el = document.createElement("div") 19 assert_equals(el.parentNode, null) 20 document.body.appendChild(el) 21 assert_equals(el.parentNode, document.body) 22 }, "Element") 23 var t = async_test("Removed iframe"); 24 function testIframe(iframe) { 25 t.step(function() { 26 var doc = iframe.contentDocument; 27 iframe.parentNode.removeChild(iframe); 28 assert_equals(doc.firstChild.parentNode, doc); 29 }); 30 t.done(); 31 } 32 </script> 33 <iframe id=a src="Node-parentNode-iframe.html" onload="testIframe(this)"></iframe>