summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/document-write/iframe_002.html
blob: f77819adb609dc5e38e9cc61c261275021ddc239 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<title>document.write 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 = "<i id='a'>Filler Text</i><b id=b>Filler Text</b>"
  for (var i=0; i<s.length; i++) {
    iframe.contentDocument.write(s[i]);
  }
  iframe.contentDocument.close();
  assert_equals(iframe.contentDocument.body.childNodes[0].textContent, "Filler Text");
  assert_equals(iframe.contentDocument.body.childNodes[0].localName, "i");
  assert_equals(iframe.contentDocument.body.childNodes[0].getAttribute('id'), "a");
  assert_equals(iframe.contentDocument.body.childNodes[1].textContent, "Filler Text");
  assert_equals(iframe.contentDocument.body.childNodes[1].localName, "b");
  assert_equals(iframe.contentDocument.body.childNodes[1].getAttribute('id'), "b");
});
</script>
<div id="log"></div>