diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/dom/dynamic-markup-insertion | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/dom/dynamic-markup-insertion')
130 files changed, 1937 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/.gitkeep b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/.gitkeep diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/.gitkeep diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml new file mode 100644 index 000000000..cccc26bf1 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/closing-the-input-stream/document.close-01.xhtml @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>document.close in XHTML</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#closing-the-input-stream"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_throws("INVALID_STATE_ERR", function() { + document.close(); + }, "document.close in XHTML should throw an INVALID_STATE_ERR "); +}, "document.close in XHTML"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/.gitkeep b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/.gitkeep diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/001.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/001.html new file mode 100644 index 000000000..3ac6423f4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/001.html @@ -0,0 +1,12 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("PASS"); + assert_equals(document.body.textContent, "PASS"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/002.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/002.html new file mode 100644 index 000000000..08975bca7 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/002.html @@ -0,0 +1,13 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/003.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/003.html new file mode 100644 index 000000000..915e1f6d6 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/003.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<"); + document.write("i>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/004.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/004.html new file mode 100644 index 000000000..dd0172586 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/004.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i"); + document.write(">Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.html new file mode 100644 index 000000000..4c161c4d4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i>"); + document.write("Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.js new file mode 100644 index 000000000..ebfd7e258 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/005.js @@ -0,0 +1 @@ +order.push(3);
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.html new file mode 100644 index 000000000..92bfb44c3 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.js new file mode 100644 index 000000000..ebfd7e258 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/006.js @@ -0,0 +1 @@ +order.push(3);
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.html new file mode 100644 index 000000000..753316b89 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i "); + document.write("id='test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.js new file mode 100644 index 000000000..31fcf18d4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/007.js @@ -0,0 +1,4 @@ +t.step(function() { + order.push(2); + document.write("<script>t.step(function() {order.push(3)})</script>"); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008-1.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008-1.js new file mode 100644 index 000000000..ef90c722b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008-1.js @@ -0,0 +1,3 @@ +t.step(function() { + order.push(3); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.html new file mode 100644 index 000000000..4818bc388 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i i"); + document.write("d='test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.js new file mode 100644 index 000000000..367597515 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/008.js @@ -0,0 +1,4 @@ +t.step(function() { + order.push(2); + document.write("<script src=\"008-1.js\"></script>"); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/009.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/009.html new file mode 100644 index 000000000..d7b78333b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/009.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id"); + document.write("='test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010-1.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010-1.js new file mode 100644 index 000000000..fd815bab7 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010-1.js @@ -0,0 +1,4 @@ +t.step(function() { + order.push(4); + assert_equals(document.getElementsByTagName("meta").length, 1); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.html new file mode 100644 index 000000000..c8b995825 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id="); + document.write("'test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.js new file mode 100644 index 000000000..bb328ad55 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/010.js @@ -0,0 +1,4 @@ +t.step(function() { + order.push(3); + assert_equals(document.getElementsByTagName("meta").length, 0); + }); diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011-1.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011-1.js new file mode 100644 index 000000000..944b70d2d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011-1.js @@ -0,0 +1,5 @@ +t.step(function() { + order.push(4); + document.write("<meta>"); + assert_equals(document.getElementsByTagName("meta").length, 1); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.html new file mode 100644 index 000000000..33464429e --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='"); + document.write("test'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.js new file mode 100644 index 000000000..ce47bcd28 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/011.js @@ -0,0 +1,5 @@ +t.step(function() { + order.push(3); + document.write("<script src='011-1.js'></script" + "><meta>"); + assert_equals(document.getElementsByTagName("meta").length, 0); + });
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.html new file mode 100644 index 000000000..c9902a487 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='te"); + document.write("st'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.js new file mode 100644 index 000000000..7ab4c6b38 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/012.js @@ -0,0 +1,5 @@ +t.step( +function() { + order.push(5); + assert_equals(document.getElementsByTagName("meta").length, 0); +});
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.html new file mode 100644 index 000000000..7b87d2897 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='test"); + document.write("'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.js new file mode 100644 index 000000000..b5ce5f27d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/013.js @@ -0,0 +1 @@ +document.write('<svg><![CDATA[');
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/014.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/014.html new file mode 100644 index 000000000..75518a898 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/014.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='test'"); + document.write(">Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/015.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/015.html new file mode 100644 index 000000000..3dd79a63e --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/015.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i id='test'"); + document.write("class='a'>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute("id"), "test"); + assert_equals(document.body.firstChild.getAttribute("class"), "a"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/016.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/016.html new file mode 100644 index 000000000..4c2f58912 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/016.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<i>Filler Text"); + document.write("</i><b>Filler Text"); + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/017.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/017.html new file mode 100644 index 000000000..8d1b24b06 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/017.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + var s = "<i id=test>Filler Text</i><b>Filler Text" + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } + assert_equals(document.body.firstChild.localName, "i"); + assert_equals(document.body.firstChild.getAttribute('id'), "test"); + assert_equals(document.body.firstChild.textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/018.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/018.html new file mode 100644 index 000000000..cf8dddbc5 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/018.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( +function() { + document.write("<body>"); + var s = "<!--comment--><i>Filler Text</i>" + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } + assert_equals(document.body.firstChild.nodeType, document.COMMENT_NODE); + assert_equals(document.body.firstChild.data, "comment"); + assert_equals(document.body.childNodes[1].localName, "i"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/019.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/019.html new file mode 100644 index 000000000..5e988f79e --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/019.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<i"); +}); +</script> +>Filler Text</i> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "i"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/020.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/020.html new file mode 100644 index 000000000..1d31bbf35 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/020.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><"); +}); +</script>!--comment--> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].nodeType, document.COMMENT_NODE); + assert_equals(document.body.childNodes[0].data, "comment"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/021.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/021.html new file mode 100644 index 000000000..500bb1939 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/021.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><sp"); +}); +</script>an>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/022.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/022.html new file mode 100644 index 000000000..53ba29901 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/022.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span>"); +}); +</script>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/023.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/023.html new file mode 100644 index 000000000..ca89e0e0b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/023.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span "); +}); +</script>id=a>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/024.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/024.html new file mode 100644 index 000000000..2a47d76cb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/024.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span i"); +}); +</script>d=a>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/025.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/025.html new file mode 100644 index 000000000..31c68cf7d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/025.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id"); +}); +</script>=a>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/026.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/026.html new file mode 100644 index 000000000..a9bce7743 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/026.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id="); +}); +</script>a>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/027.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/027.html new file mode 100644 index 000000000..dcfd67c0f --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/027.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id=a"); +}); +</script>>Filler Text</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/028.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/028.html new file mode 100644 index 000000000..f5b7e9ef2 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/028.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id=a>Filler Text<"); +}); +</script>/span><b>Filler Text</b></span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/029.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/029.html new file mode 100644 index 000000000..f005a7222 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/029.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id=a>Filler Text</"); +}); +</script>span><b>Filler Text</b></span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/030.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/030.html new file mode 100644 index 000000000..cc361d3aa --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/030.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id=a>Filler Text</sp"); +}); +</script>an><b>Filler Text</b></span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/031.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/031.html new file mode 100644 index 000000000..32c97c505 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/031.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span id=a>Filler Text</span"); +}); +</script>><b>Filler Text</b></span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "span"); + assert_equals(document.body.childNodes[0].getAttribute("id"), "a"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); + assert_equals(document.body.childNodes[1].localName, "b"); + assert_equals(document.body.childNodes[1].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/032.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/032.html new file mode 100644 index 000000000..1a33408f1 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/032.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var tag_name_length = 100000; + var tag_name = ""; + for (var i=0; i<tag_name_length; i++) { + tag_name += "a"; + } + document.write("<body><" + tag_name + ">Filler Text</" + tag_name + ">"); +}); +</script> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/033.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/033.html new file mode 100644 index 000000000..1b8e1c270 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/033.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +test( + function() { + document.writeln("<i"); + var s = " b='a'>Filler" + for (var i=0; i<s.length; i++) { + document.write(s[i]+"\n"); + } + document.writeln("</i"); + document.writeln(">"); + assert_equals(document.body.childNodes[0].localName, "i"); + assert_equals(document.body.childNodes[0].getAttribute("b"), "\na\n"); + assert_equals(document.body.childNodes[0].textContent, "\nF\ni\nl\nl\ne\nr\n"); + } +); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/034.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/034.html new file mode 100644 index 000000000..abd481a64 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/034.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<svg><![CDATA[Filler Text]]></svg>"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "svg"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/035.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/035.html new file mode 100644 index 000000000..a1e7f9ee6 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/035.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<svg><!"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script>[CDATA[Filler Text]]></svg> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "svg"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/036.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/036.html new file mode 100644 index 000000000..8719e0598 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/036.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<svg><![CDATA[Filler Text]"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script>]></svg> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "svg"); + assert_equals(document.body.childNodes[0].textContent, "Filler Text"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/037.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/037.html new file mode 100644 index 000000000..cf0787ce7 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/037.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<body><!DOCTYPE html>"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script><script> +t.step(function() { + //Nothing should be inserted into the DOM for the doctype node so + //just checking nothing odd happens + assert_equals(document.body.childNodes[0].localName, "script"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/038.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/038.html new file mode 100644 index 000000000..4ae9d32b2 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/038.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<body><"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script>!DOCTYPE html><script> +t.step(function() { + //Nothing should be inserted into the DOM for the doctype node so + //just checking nothing odd happens + assert_equals(document.body.childNodes[0].localName, "script"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/039.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/039.html new file mode 100644 index 000000000..611a01390 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/039.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<body><!"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script>DOCTYPE html><script> +t.step(function() { + //Nothing should be inserted into the DOM for the doctype node so + //just checking nothing odd happens + assert_equals(document.body.childNodes[0].localName, "script"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/040.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/040.html new file mode 100644 index 000000000..d76deffa4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/040.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>document.write entity</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = test(function() { + document.write("<body><span>∉abc"); + assert_equals(document.body.childNodes[0].textContent, "\u2209abc"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/041.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/041.html new file mode 100644 index 000000000..592711c94 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/041.html @@ -0,0 +1,13 @@ +<!doctype html> +<title>document.write entity</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = test(function() { + var s = "<body><span>∉abc"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } + assert_equals(document.body.childNodes[0].textContent, "\u2209abc"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/042.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/042.html new file mode 100644 index 000000000..e15f1d0c0 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/042.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>document.write entity</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span>¬"); +}); +</script>in;abc</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].textContent, "\u2209abc"); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/043.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/043.html new file mode 100644 index 000000000..4058e7a82 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/043.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>document.write entity</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><span>&"); +}); +</script>notabc</span> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].textContent, "\u00ACabc"); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/044.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/044.html new file mode 100644 index 000000000..4c9f50273 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/044.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<body><textarea><span>Filler</span></textarea>"); +}); +</script> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "textarea"); + assert_equals(document.body.childNodes[0].textContent, "<span>Filler</span>"); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/045.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/045.html new file mode 100644 index 000000000..987eabf0f --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/045.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<body><textarea><span>Filler</span></textarea>"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "textarea"); + assert_equals(document.body.childNodes[0].textContent, "<span>Filler</span>"); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/046.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/046.html new file mode 100644 index 000000000..e87e9cc82 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/046.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<body><textarea>"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script><span>Filler</span></textarea> +<script> +t.step(function() { + assert_equals(document.body.childNodes[0].localName, "textarea"); + assert_equals(document.body.childNodes[0].textContent, "<span>Filler</span>"); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/047.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/047.html new file mode 100644 index 000000000..51faf6c85 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/047.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +onload = function() { + t.step(function() { + document.write("<body>Filler Text<div id='log'></div>"); + assert_equals(document.body.textContent, "Filler Text"); + }); + t.done(); +}; +</script> +<body>FAIL +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/048.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/048.html new file mode 100644 index 000000000..51faf6c85 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/048.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +onload = function() { + t.step(function() { + document.write("<body>Filler Text<div id='log'></div>"); + assert_equals(document.body.textContent, "Filler Text"); + }); + t.done(); +}; +</script> +<body>FAIL +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/049.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/049.html new file mode 100644 index 000000000..0ec282f2b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/049.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>document.write plaintext</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<div id="log"></div><script> +test(function() { + var s = "<table><tr><td>Text</tr><plaintext><tr><td>Filler "; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } + document.close(); + assert_equals(document.body.childNodes[2].nodeType, document.ELEMENT_NODE); + assert_equals(document.body.childNodes[2].localName, "plaintext"); + assert_equals(document.body.childNodes[2].textContent, "<tr><td>Filler "); + assert_equals(document.body.childNodes[3].nodeType, document.ELEMENT_NODE); + assert_equals(document.body.childNodes[3].localName, "table"); + assert_equals(document.body.childNodes[3].textContent, "Text"); +}); +</script>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/050.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/050.html new file mode 100644 index 000000000..0a37fa4c5 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/050.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>document.write plaintext</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<div id="log"></div><script> +var t = async_test(); + +t.step(function() { + document.write("<plaintext>"); + assert_equals(document.body.childNodes[2].nodeType, document.ELEMENT_NODE); + assert_equals(document.body.childNodes[2].localName, "plaintext"); + var s = "Filler "; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + assert_equals(document.body.childNodes[2].textContent, s.slice(0,i+1)); + } + document.close(); +}); + +onload = function() { + t.step(function() { + assert_equals(document.body.childNodes[2].textContent, "Filler Text\n"); + }); + t.done(); +} +</script>Text diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/051.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/051.html new file mode 100644 index 000000000..cdbad22b5 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/051.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>document.write \r\n</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<div id="log"></div><script> +var t = async_test() +t.step(function() { + document.write("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nA"); +}) + +onload = function() { + t.step(function() { + assert_equals(document.body.lastChild.data, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nA\n"); + }); + t.done(); +}; +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml new file mode 100644 index 000000000..ec8702a74 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-01.xhtml @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>document.write in XHTML</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#document.write%28%29"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_throws("INVALID_STATE_ERR", function() { + document.write("Failure: document.write actually worked"); + }, "document.write in XHTML should throw an INVALID_STATE_ERR "); +}, "document.write in XHTML"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-02.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-02.html new file mode 100644 index 000000000..4c25da8b6 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/document.write-02.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>document.write and null/undefined</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-write%28%29"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#documents-in-the-dom"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + var iframe = document.createElement("iframe"); + document.body.appendChild(iframe); + doc = iframe.contentDocument; + test(function() { + doc.open(); + doc.write(null); + doc.close(); + assert_equals(doc.documentElement.textContent, "null"); + }, "document.write(null)"); + test(function() { + doc.open(); + doc.write(undefined); + doc.close(); + assert_equals(doc.documentElement.textContent, "undefined"); + }, "document.write(undefined)"); +}, "Calling document.write with null and undefined"); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_001.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_001.html new file mode 100644 index 000000000..8b54560c6 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_001.html @@ -0,0 +1,14 @@ +<!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"); + iframe.contentDocument.write("Filler Text"); + iframe.contentDocument.close(); + assert_equals(iframe.contentDocument.body.textContent, "Filler Text"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_002.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_002.html new file mode 100644 index 000000000..f77819adb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_002.html @@ -0,0 +1,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>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_003.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_003.html new file mode 100644 index 000000000..9865874da --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_003.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>document.write script 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 = "<script>document.write(\"<i id='a'>Filler Text</i>\")</script" + "><b id=b>Filler Text</b>" + for (var i=0; i<s.length; i++) { + iframe.contentDocument.write(s[i]); + } + iframe.contentDocument.close(); + //Note: <script> ends up in <head> + 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>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_004.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_004.html new file mode 100644 index 000000000..a4d7b1dda --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_004.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>document.write script into iframe write back into parent</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<iframe id="test"></iframe> +<script> +var t = async_test(); +var iframe = document.getElementById("test"); +var order = []; +t.step(function() { + order.push(1); + var s = "<script>parent.order.push(2); parent.document.write('<script>order.push(3);</script'+'>'); parent.order.push(4)</script" + ">"; + for (var i=0; i<s.length; i++) { + iframe.contentDocument.write(s[i]); + } + iframe.contentDocument.close(); + order.push(5); + assert_array_equals(order, [1,2,3,4,5]) +} +); +t.done(); +</script> +<div id="log"></div>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.html new file mode 100644 index 000000000..7bc3ed6c2 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>document.write external script into iframe write back into parent</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<iframe id="test"></iframe> +<script> +var t = async_test(); +var iframe = document.getElementById("test"); +var order = []; +t.step(function() { + order.push(1); + var s = "<script src='iframe_005.js'></script" + ">"; + iframe.contentDocument.write(s); + iframe.contentDocument.close(); + order.push(2); + assert_array_equals(order, [1,2]) +} +); +addEventListener("load", function() { + t.step(function() { + assert_array_equals(order, [1,2,3,4,5]) + }); + t.done(); +}, false); +</script> +<div id="log"></div>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.js new file mode 100644 index 000000000..bf038f700 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_005.js @@ -0,0 +1,3 @@ +parent.order.push(3); +document.write("<script>parent.order.push(4)</script>"); +parent.order.push(5);
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_006.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_006.html new file mode 100644 index 000000000..d080ee367 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_006.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write external script into iframe write back into parent</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<iframe id="test"></iframe> +<script> +var t = async_test(); +var iframe = document.getElementById("test"); +var order = []; +t.step(function() { + order.push(1); + var s = "<script>parent.order.push(2); parent.document.write('<script>order.push(3); iframe.contentDocument.write(\"<script>parent.order.push(4)</script\"+\">\");order.push(5);</script' + '>'); parent.order.push(6)</script"+">"; + iframe.contentDocument.write(s); + iframe.contentDocument.close(); + order.push(7); + assert_array_equals(order, [1,2,3,4,5,6,7]); +}); +t.done(); +</script> +<div id="log"></div>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_007.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_007.html new file mode 100644 index 000000000..c00aa7062 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_007.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>document.write comment 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 = "<!--Filler-->"; + for (var i=0; i<s.length; i++) { + iframe.contentDocument.write(s); + } + iframe.contentDocument.close(); + assert_equals(iframe.contentDocument.childNodes[0].nodeType, document.COMMENT_NODE); + assert_equals(iframe.contentDocument.childNodes[0].data, "Filler"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_008.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_008.html new file mode 100644 index 000000000..c814958d1 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_008.html @@ -0,0 +1,18 @@ +<!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 = "<plaintext><span>Filler Text"; + 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, "<span>Filler Text"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_009.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_009.html new file mode 100644 index 000000000..8b271c7a0 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_009.html @@ -0,0 +1,21 @@ +<!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> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_010.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_010.html new file mode 100644 index 000000000..8dc21a013 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/iframe_010.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>document.write plaintext</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<iframe id="test"></iframe> +<script> +var t = async_test(); +var iframe = document.getElementById("test"); + +function check_dom() { + assert_equals(iframe.contentDocument.body.childNodes[0].localName, "plaintext") + assert_equals(iframe.contentDocument.body.childNodes[0].textContent, "Filler ") + assert_equals(iframe.contentDocument.body.childNodes[1].localName, "table") +} + +t.step(function() { + var s = "<script>document.write('<table><plaintext>Filler '); document.close(); top.t.step(function() {top.check_dom()})</script" + ">"; + for (var i=0; i<s.length; i++) { + iframe.contentDocument.write(s[i]); + } + t.done(); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html new file mode 100644 index 000000000..c7a7a1db4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-1.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<body>You should see the word "worked" below<br><script>document.write("\u003cscript>document.write(\"\\u003cscript src='nested-document-write-external.js'>\\u003c/script>r\"); document.write(\"k\");\u003c/script>e"); document.write("d");</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html new file mode 100644 index 000000000..60b8eae1e --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-2.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> +<body> +You should see the word "worked" in the frame below.<br> +<iframe></iframe> +<script> +var doc = document.getElementsByTagName("iframe")[0].contentDocument; +doc.open(); doc.write("\u003cscript>document.write(\"\\u003cscript src='nested-document-write-external.js'>\\u003c/script>r\"); document.write(\"k\");\u003c/script>e"); doc.write("d"); doc.close();</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js new file mode 100644 index 000000000..bf91daf98 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/nested-document-write-external.js @@ -0,0 +1 @@ +document.write("w"); document.write("o"); diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/original-id.json b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/original-id.json new file mode 100644 index 000000000..08bd4d0d4 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/original-id.json @@ -0,0 +1 @@ +{"original_id":"document.write()"}
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_001.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_001.html new file mode 100644 index 000000000..43c7adb4d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_001.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>document.write script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<script>t.done();<"+"/script>"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_002.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_002.html new file mode 100644 index 000000000..3879d8489 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_002.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write script executed synchronously</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + document.write("<script>t.step(function() {order.push(1);});<"+"/script>"); + order.push(2); +}); +</script> +<script> +t.step(function() { + order.push(3); + assert_array_equals(order, [1,2,3]); +}) +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_003.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_003.html new file mode 100644 index 000000000..e669252f7 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_003.html @@ -0,0 +1,10 @@ +<!doctype html> +<title>document.write script writing a further script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + document.write("<script>document.write('<script>t.done()</script'+'>')<"+"/script>"); +}); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_004.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_004.html new file mode 100644 index 000000000..15fda325b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_004.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write script writing script; order of execution</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script>order.push(2); document.write('<script>order.push(3);</script'+'>'); order.push(4);<"+"/script>"); + order.push(5); +}); +</script> +<script> +t.step(function() { + assert_array_equals(order, [1,2,3,4,5]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_005.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_005.html new file mode 100644 index 000000000..b99196c7d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_005.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write external script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script src='005.js'><"+"/script>"); + order.push(2); +}); +</script> +<script> +order.push(4); +t.step(function() { + assert_array_equals(order, [1,2,3,4]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_006.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_006.html new file mode 100644 index 000000000..c8dd9a5f9 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_006.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>document.write external script followed by internal script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script src='006.js'><"+"/script><script>t.step(function(){order.push(4)})</script"+">"); + order.push(2); +}); +</script> +<script> +t.step(function() { + order.push(5); + assert_array_equals(order, [1,2,3,4,5]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_007.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_007.html new file mode 100644 index 000000000..fbbe5b2f8 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_007.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write external script that document.writes inline script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); +}); +</script> +<script src="007.js"></script> +<script> +t.step(function() { + order.push(4); + assert_array_equals(order, [1,2,3,4]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_008.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_008.html new file mode 100644 index 000000000..c5a44dc70 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_008.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write external script that document.writes external script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); +}); +</script> +<script src="008.js"></script> +<script> +t.step(function() { + order.push(4); + assert_array_equals(order, [1,2,3,4]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_009.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_009.html new file mode 100644 index 000000000..d12d934ea --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_009.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>document.write script that document.writes script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script>order.push(2); document.write('<script>order.push(3); document.write(\"<script>order.push(4);</script\"+\">\"); order.push(5);</script' + '>'); order.push(6);</script" + ">"); + order.push(7); +}); +</script> +<script> +t.step(function() { + assert_array_equals(order, [1,2,3,4,5,6,7]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_010.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_010.html new file mode 100644 index 000000000..93728d6f2 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_010.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>document.write external script tokenizer order</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script src='010.js'></script" + "><meta><script src='010-1.js'></script" + ">"); + order.push(2); + assert_equals(document.getElementsByTagName("meta").length, 0); +}); +</script> +<script> +t.step(function() { + order.push(5); + assert_equals(document.getElementsByTagName("meta").length, 1); + assert_array_equals(order, [1,2,3,4,5]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_011.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_011.html new file mode 100644 index 000000000..2bbcaf976 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_011.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>document.write external script that document.writes external script</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script src='011.js'></script" + "><meta>"); + order.push(2); + assert_equals(document.getElementsByTagName("meta").length, 0); +}); +</script> +<script> +t.step(function() { + order.push(5); + assert_equals(document.getElementsByTagName("meta").length, 3, "Number of meta elements at end"); + assert_array_equals(order, [1,2,3,4,5]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_012.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_012.html new file mode 100644 index 000000000..57755f4c9 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_012.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>document.write external script tokenizer order</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +var order = []; +t.step(function() { + order.push(1); + document.write("<script>order.push(2); document.write('<script src=\"012.js\"></script' + '><meta>'); order.push(3); t.step(function() {assert_equals(document.getElementsByTagName('meta').length, 0)});</script" + "><meta>"); + order.push(4); + assert_equals(document.getElementsByTagName("meta").length, 0); +}); +</script> +<script> +t.step(function() { + order.push(6); + assert_equals(document.getElementsByTagName("meta").length, 2); + assert_array_equals(order, [1,2,3,4,5,6]); +}); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_013.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_013.html new file mode 100644 index 000000000..0e71e5eb0 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-write/script_013.html @@ -0,0 +1,24 @@ +<!doctype html> +<title>document.write</title> +<script src="/resources/testharness.js"></script><script src="/resources/testharnessreport.js"></script> +<script> +var t = async_test(); +t.step(function() { + var s = "<script src='013.js'><" + "/script></svg>]]><path></svg>"; + for (var i=0; i<s.length; i++) { + document.write(s[i]); + } +}); +</script><script> +t.step(function() { + assert_equals(document.body.childNodes[0].nodeType, document.ELEMENT_NODE); + assert_equals(document.body.childNodes[0].localName, "svg"); + assert_equals(document.body.childNodes[0].childNodes[0].nodeType, document.TEXT_NODE); + assert_equals(document.body.childNodes[0].childNodes[0].data, "</svg>"); + assert_equals(document.body.childNodes[0].childNodes[1].nodeType, document.ELEMENT_NODE); + assert_equals(document.body.childNodes[0].childNodes[1].localName, "path"); +} +); +t.done(); +</script> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/.gitkeep b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/.gitkeep diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml new file mode 100644 index 000000000..3d59bcd20 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-01.xhtml @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>document.writeln in XHTML</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#document.writeln%28%29"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_throws("INVALID_STATE_ERR", function() { + document.writeln("Failure: document.writeln actually worked"); + }, "document.writeln in XHTML should throw an INVALID_STATE_ERR "); +}, "document.writeln in XHTML"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html new file mode 100644 index 000000000..2a64ac756 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-02.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>document.writeln and null/undefined</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-writeln%28%29"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#documents-in-the-dom"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + var iframe = document.createElement("iframe"); + document.body.appendChild(iframe); + doc = iframe.contentDocument; + test(function() { + doc.open(); + doc.writeln(null); + doc.close(); + assert_equals(doc.documentElement.textContent, "null\n"); + }, "document.writeln(null)"); + test(function() { + doc.open(); + doc.writeln(undefined); + doc.close(); + assert_equals(doc.documentElement.textContent, "undefined\n"); + }, "document.writeln(undefined)"); +}, "Calling document.writeln with null and undefined"); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html new file mode 100644 index 000000000..df9a7a15c --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/document.writeln-03.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>document.writeln with multiple arguments</title> +<link rel="author" title="Sebmaster" href="mailto:wpt@smayr.name"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-writeln%28%29"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#documents-in-the-dom"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + var iframe = document.createElement("iframe"); + document.body.appendChild(iframe); + var doc = iframe.contentDocument; + doc.open(); + doc.writeln('a', 'b'); + doc.close(); + assert_equals(doc.documentElement.textContent, "ab\n"); +}, "Calling document.writeln with multiple arguments"); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/original-id.json b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/original-id.json new file mode 100644 index 000000000..0cc32be6a --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/document-writeln/original-id.json @@ -0,0 +1 @@ +{"original_id":"document.writeln()"}
\ No newline at end of file diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/.gitkeep diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html new file mode 100644 index 000000000..f82d80be7 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/001.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Replacement of window object after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe></iframe> +<script> +var t = async_test(); + +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.contentWindow.state = 1; + var handle = iframe.contentWindow; + iframe.contentDocument.open(); + assert_false("state" in iframe.contentWindow, "Variables are not preserved after document.open"); + assert_equals(iframe.contentWindow.state, undefined, "Variables are not preserved after document.open"); + assert_equals(iframe.contentWindow, handle); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html new file mode 100644 index 000000000..42f6c580c --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/002.html @@ -0,0 +1,12 @@ +<!doctype html> +<title>document.open during parsing</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + var log = document.getElementById("log"); + document.open() + assert_equals(document.getElementById("log"), log) +}) +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html new file mode 100644 index 000000000..c50eddd41 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004-1.html @@ -0,0 +1 @@ +<!doctype html> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html new file mode 100644 index 000000000..f489caa72 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/004.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>Reuse of document object after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); +var iframe; +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var handle = iframe.contentDocument; + iframe.contentDocument.test_state = 1; + iframe.contentDocument.open(); + assert_equals(iframe.contentDocument.test_state, 1); + assert_equals(iframe.contentDocument, handle); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html new file mode 100644 index 000000000..6bd850520 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/005.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>Cancelling timeout after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); +var iframe; +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.contentWindow.setTimeout(t.step_func(function() {assert_unreached()}), 100); + iframe.contentDocument.open() + setTimeout(function() {t.done();}, 200); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html new file mode 100644 index 000000000..692d06d98 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/006.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>Cancelling error after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); +var iframe; +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var img = iframe.contentDocument.createElement("img"); + img.onerror = t.step_func(function() {assert_unreached()}) + img.src = "missing"; + iframe.contentDocument.body.appendChild(img); + iframe.contentDocument.open() + setTimeout(function() {t.done();}, 500); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html new file mode 100644 index 000000000..e5f0d1561 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/007.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>Unregistering event handlers after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); +var iframe; +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.contentDocument.onclick = t.step_func(function() {assert_unreached()}) + iframe.contentDocument.open(); + var e = iframe.contentDocument.createEvent("mouseevents") + e.initEvent("click", false, false); + iframe.contentDocument.dispatchEvent(e); + setTimeout(function() {t.done();}, 500); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html new file mode 100644 index 000000000..08fd4aa43 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/008.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Replacement of document prototype object after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); +var iframe; +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var handle = Object.getPrototypeOf(iframe.contentDocument); + handle.test_state = 1; + iframe.contentDocument.open(); + var new_handle = Object.getPrototypeOf(iframe.contentDocument); + assert_equals(new_handle.test_state, undefined); + assert_not_equals(new_handle, handle); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.html new file mode 100644 index 000000000..4fc5163ea --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/009.html @@ -0,0 +1,34 @@ +<!doctype html> +<title>document.open replacing singleton</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var iframe = document.getElementsByTagName("iframe")[0]; +var steps; +iframe.onload = function() { +steps = ["window", "location", "history", "navigator", "applicationCache", "sessionStorage", "localStorage", "locationbar"].map( +function(x) { + var t = async_test(document.title + " " + x); + var handle = iframe.contentWindow[x]; + handle.test_state = 1; + return t.step_func( + function() { + var new_handle = iframe.contentWindow[x]; + assert_equals(new_handle.test_state, undefined); + if (x !== "window") { + assert_not_equals(new_handle, handle); + } else { + assert_equals(new_handle, handle); + } + t.done(); + }); + } +); +} +onload = function() { + iframe.contentDocument.open(); + steps.forEach(function(x) {x()}); +} +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html new file mode 100644 index 000000000..317e13691 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-1.html @@ -0,0 +1,2 @@ +<!doctype html> +010-1 diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html new file mode 100644 index 000000000..ea537fcd6 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010-2.html @@ -0,0 +1,5 @@ +<!doctype html> +010-2 +<script> +onload = function() {history.back()} +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html new file mode 100644 index 000000000..f37e8855d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/010.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Salvagability of document.opened document</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="010-1.html"></iframe> +<script> +var iframe; +var t = async_test(); +onload = t.step_func(function() { + iframe = document.getElementsByTagName("iframe")[0]; + iframe.contentDocument.open(); + iframe.contentDocument.close(); + + iframe.contentWindow.setTimeout(t.step_func(function() {t.done();}), 500); + + onload = null; + + iframe.src = "010-2.html" + setTimeout(t.step_func(function() {assert_unreached()}), 1000) +}) +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html new file mode 100644 index 000000000..e12d78f4a --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011-1.html @@ -0,0 +1,5 @@ +<script> +document.open() +setTimeout(parent.t.step_func(function() {parent.t.done()}), 0); +document.close(); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html new file mode 100644 index 000000000..2acc884c5 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/011.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Timeout after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +</script> +<iframe src="011-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html new file mode 100644 index 000000000..b1937b2f8 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012-1.html @@ -0,0 +1,7 @@ +<script> +onload = parent.t.step_func(function() { + document.open() + setTimeout(parent.t.step_func(function() {parent.t.done()}), 0); + document.close(); +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html new file mode 100644 index 000000000..518454858 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/012.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Timeout after document.open in load event</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +</script> +<iframe src="012-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html new file mode 100644 index 000000000..ed8843bbd --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013-1.html @@ -0,0 +1,7 @@ +<script> +addEventListener("DOMContentLoaded", parent.t.step_func(function() { + document.open() + setTimeout(parent.t.step_func(function() {parent.t.done()}), 0); + document.close(); +}), false); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html new file mode 100644 index 000000000..5749361aa --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/013.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Timeout after document.open in DOMContentLoaded event</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +</script> +<iframe src="013-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html new file mode 100644 index 000000000..6d04da565 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014-1.html @@ -0,0 +1,9 @@ +<script> +onload = parent.t.step_func(function() { + setTimeout(parent.t.step_func(function() { + document.open() + setTimeout(parent.t.step_func(function() {parent.t.done()}), 0); + document.close(); + }), 100) +}); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html new file mode 100644 index 000000000..b4e4b17cf --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/014.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Timeout after document.open after document is completely loaded</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +</script> +<iframe src="014-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html new file mode 100644 index 000000000..670710090 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015-1.html @@ -0,0 +1,17 @@ +<script> +onload = function() { + window.test_prop = 1; + parent.tests[0].step(function() {parent.assert_equals(test_prop, 1)}); + document.open(); + document.write("<script>test_prop = 2;<\/script>"); + document.close(); + parent.tests[0].step(function() {parent.assert_equals(test_prop, 1)}); + parent.tests[1].step(function() {parent.assert_equals(window.test_prop, 2)}); + parent.tests[2].step(function() {parent.assert_equals(get_this(), window)}); + parent.tests_done(); +}; + +function get_this() { + return this; +} +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html new file mode 100644 index 000000000..5ef06176b --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/015.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>Window vs global scope after document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var tests = [async_test("global scope unchanged"), + async_test("window object changed"), + async_test("this is the window object")]; +function tests_done() { + tests.forEach(function(t) {t.done()}); +} +</script> +<iframe src="015-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html new file mode 100644 index 000000000..17f5140ec --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016-1.html @@ -0,0 +1,39 @@ +<script> +window.test_prop = 1; +</script> +<script> +onload = function() { + document.open(); + document.write("<script>test_prop = 2; timeout_fired=false;<\/script>"); + document.close(); + + setTimeout(function() { + parent.tests[0].step(function() { + parent.assert_equals(test_prop, 1, "Global scope from original window timeout"); + parent.assert_equals(window.test_prop, 2, "Window property from original window timeout") + }); + parent.tests[1].step(function() { + var t = get_this(); + parent.assert_equals(t.test_prop, 2, "Window property from original window timeout"); + parent.assert_equals(t, window, "Global scope from original window timeout"); + }); + }, 0); + + window.setTimeout(function() { + parent.tests[2].step(function() { + parent.assert_equals(test_prop, 1, "Global scope from original window timeout"); + parent.assert_equals(window.test_prop, 2, "Window property from original window timeout") + }); + parent.tests[3].step(function() { + var t = get_this(); + parent.assert_equals(t.test_prop, 2, "Window property from original window timeout"); + parent.assert_equals(t, window, "Global scope from original window timeout"); + }); + parent.tests_done(); + }, 100); +}; + +function get_this() { + return this; +} +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html new file mode 100644 index 000000000..1c70fce59 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/016.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>setTimeout document.open</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var tests = [async_test("Timeout on original window, scope"), + async_test("Timeout on original window, this object"), + async_test("Timeout on new window, scope"), + async_test("Timeout on new window, this object")]; +function tests_done() { + tests.forEach(function(t) {t.done()}); +} +</script> +<iframe src="016-1.html"></iframe> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml new file mode 100644 index 000000000..974702ae8 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-01.xhtml @@ -0,0 +1,19 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>document.open in XHTML</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#opening-the-input-stream"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_throws("INVALID_STATE_ERR", function() { + document.open(); + }, "document.open in XHTML should throw an INVALID_STATE_ERR "); +}, "document.open in XHTML"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html new file mode 100644 index 000000000..b56e3a836 --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<title>document.open with three arguments</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-open"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +function open() { + assert_unreached("The call should be redirected to the real window.open") +} +test(function(t) { + var w; + t.add_cleanup(function() {try {w.close()} catch(e) {}}); + w = document.open("/resources/testharness.js", "", ""); + assert_true(w instanceof w.Window, "Expected a window"); +}, "document.open should redirect to window.open when called with three arguments"); + +test(function() { + var parser = new DOMParser(); + var doc = parser.parseFromString("", "text/html"); + assert_equals(doc.defaultView, null); + assert_throws("INVALID_ACCESS_ERR", function() { + doc.open("/resources/testharness.js", "", ""); + }); +}, "document.open should throw when it has no window and is called with three arguments"); +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html new file mode 100644 index 000000000..b5252dcea --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03-frame.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<script> +onload = function() { + document.open(); + document.close(); + parent.report(window.setTimeout === setTimeout, false, "setTimeout"); + parent.report(window === this, true, "this"); + parent.done(); +} +</script> diff --git a/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html new file mode 100644 index 000000000..fc325d54d --- /dev/null +++ b/testing/web-platform/tests/html/dom/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>document.open and singleton replacement</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-open"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +function report(actual, expected, message) { + t.step(function() { + assert_equals(actual, expected, message); + }); +} +function done() { + t.done(); +} +</script> +<iframe src=document.open-03-frame.html></iframe> |