iframe_009.html (1005B)
1 <!doctype html> 2 <title>document.write plaintext into iframe</title> 3 <script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> 4 <iframe id="test"></iframe> 5 <script> 6 test(function() { 7 var iframe = document.getElementById("test"); 8 var s = "<table><tr><td>Text</tr><plaintext><tr><td>Filler "; 9 for (var i=0; i<s.length; i++) { 10 iframe.contentDocument.write(s[i]); 11 } 12 iframe.contentDocument.close(); 13 assert_equals(iframe.contentDocument.body.childNodes[0].nodeType, document.ELEMENT_NODE); 14 assert_equals(iframe.contentDocument.body.childNodes[0].localName, "plaintext"); 15 assert_equals(iframe.contentDocument.body.childNodes[0].textContent, "<tr><td>Filler "); 16 assert_equals(iframe.contentDocument.body.childNodes[1].nodeType, document.ELEMENT_NODE); 17 assert_equals(iframe.contentDocument.body.childNodes[1].localName, "table"); 18 assert_equals(iframe.contentDocument.body.childNodes[1].textContent, "Text"); 19 }); 20 </script> 21 <div id="log"></div>