about summary refs log tree commit diff stats
path: root/test/js/docwrite4.html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-21 21:26:27 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-21 21:28:45 +0200
commite3d9ee2c6224cd30bf56e24f7988899e0e3985c1 (patch)
tree31116d7d751d058f32bf43313c12673423e8d8be /test/js/docwrite4.html
parentba88f015ea500bcc574b621392c721ef2c9dbcd0 (diff)
downloadchawan-e3d9ee2c6224cd30bf56e24f7988899e0e3985c1.tar.gz
test: add js & layout tests
(Sadly some layout tests still fail.)
Diffstat (limited to 'test/js/docwrite4.html')
-rw-r--r--test/js/docwrite4.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/js/docwrite4.html b/test/js/docwrite4.html
new file mode 100644
index 00000000..0f0988b5
--- /dev/null
+++ b/test/js/docwrite4.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<title>document.write test</title>
+<script>
+window.onload = function() {
+	const success = document.body.innerHTML == document.querySelector("style").textContent;
+	while (document.body.childNodes[0])
+		document.body.childNodes[0].remove();
+	document.body.innerHTML = success ? "Success" : "Fail";
+}
+let checkpointCounter = 0;
+function checkpoint(n) {
+	if (++checkpointCounter != n)
+		throw new TypeError(`Checkpoint failed: expected ${n} but got ${checkpointCounter}`);
+}
+</script>
+<style><script>
+document.write(`<script>
+document.write("a");
+`);
+document.write(`
+document.write("<script></scr" + "ipt>x");
+`);
+document.write(`
+document.write("t");
+</scr` + "ipt>");
+</script><script>
+document.write("a");
+
+document.write("<script></scr" + "ipt>x");
+
+document.write("t");
+</script>a<script></script>xt
+
+</style>
+</head>
+<body><script>
+document.write(`<script>
+document.write("a");
+`);
+document.write(`
+document.write("<script></scr" + "ipt>x");
+`);
+document.write(`
+document.write("t");
+</scr` + "ipt>");
+</script></body>
+</html>