Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/webappapis/dynamic-markup-insertion/document-write/iframe_009.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>document.write plaintext into iframe</title>
<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script>
<iframe id="test"></iframe>
<script>
test(function() {
var iframe = document.getElementById("test");
var s = "<table><tr><td>Text</tr><plaintext><tr><td>Filler ";
for (var i=0; i<s.length; i++) {
iframe.contentDocument.write(s[i]);
}
iframe.contentDocument.close();
assert_equals(iframe.contentDocument.body.childNodes[0].nodeType, document.ELEMENT_NODE);
assert_equals(iframe.contentDocument.body.childNodes[0].localName, "plaintext");
assert_equals(iframe.contentDocument.body.childNodes[0].textContent, "<tr><td>Filler ");
assert_equals(iframe.contentDocument.body.childNodes[1].nodeType, document.ELEMENT_NODE);
assert_equals(iframe.contentDocument.body.childNodes[1].localName, "table");
assert_equals(iframe.contentDocument.body.childNodes[1].textContent, "Text");
});
</script>
<div id="log"></div>