document.write-02.html (986B)
1 <!DOCTYPE html> 2 <title>document.write and null/undefined</title> 3 <link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-write%28%29"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#documents-in-the-dom"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="log"></div> 9 <script> 10 test(function() { 11 var iframe = document.createElement("iframe"); 12 document.body.appendChild(iframe); 13 doc = iframe.contentDocument; 14 test(function() { 15 doc.open(); 16 doc.write(null); 17 doc.close(); 18 assert_equals(doc.documentElement.textContent, "null"); 19 }, "document.write(null)"); 20 test(function() { 21 doc.open(); 22 doc.write(undefined); 23 doc.close(); 24 assert_equals(doc.documentElement.textContent, "undefined"); 25 }, "document.write(undefined)"); 26 }, "Calling document.write with null and undefined"); 27 </script>