document.title-02.xhtml (1248B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>document.title with head blown away</title> 4 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#document.title"/> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <div id="log"></div> 11 <script> 12 test(function() { 13 assert_equals(document.title, "document.title with head blown away"); 14 }) 15 test(function() { 16 var head = document.getElementsByTagName("head")[0]; 17 assert_true(!!head, "Head gone?!") 18 head.parentNode.removeChild(head); 19 assert_false(!!document.getElementsByTagName("head")[0], "Head still there?!") 20 document.title = "FAIL"; 21 assert_equals(document.title, ""); 22 }) 23 test(function() { 24 var title2 = document.createElement("title"); 25 title2.appendChild(document.createTextNode("PASS")); 26 document.body.appendChild(title2); 27 assert_equals(document.title, "PASS"); 28 }) 29 test(function() { 30 var title3 = document.createElement("title"); 31 title3.appendChild(document.createTextNode("PASS2")); 32 document.documentElement.insertBefore(title3, document.body); 33 assert_equals(document.title, "PASS2"); 34 }) 35 </script> 36 </body> 37 </html>