document.writeln-02.html (1004B)
1 <!DOCTYPE html> 2 <title>document.writeln 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-writeln%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.writeln(null); 17 doc.close(); 18 assert_equals(doc.documentElement.textContent, "null\n"); 19 }, "document.writeln(null)"); 20 test(function() { 21 doc.open(); 22 doc.writeln(undefined); 23 doc.close(); 24 assert_equals(doc.documentElement.textContent, "undefined\n"); 25 }, "document.writeln(undefined)"); 26 }, "Calling document.writeln with null and undefined"); 27 </script>