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