summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js')
-rw-r--r--testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js
new file mode 100644
index 0000000000..4efbb863c6
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/mutation-events.window.js
@@ -0,0 +1,22 @@
+// In an ideal world this test would eventually be obsolete due to mutation events disappearing. Or
+// would have to change to account for mutation events not firing synchronously. Neither seems
+// realistic to the author though.
+
+test(t => {
+ const frame = document.body.appendChild(document.createElement("iframe"));
+ frame.contentWindow.addEventListener("DOMNodeInserted", t.unreached_func());
+ frame.contentWindow.addEventListener("DOMNodeInserted", t.unreached_func(), true);
+ frame.contentWindow.addEventListener("DOMNodeInsertedIntoDocument", t.unreached_func(), true);
+ frame.contentWindow.addEventListener("DOMNodeRemoved", t.unreached_func());
+ frame.contentWindow.addEventListener("DOMNodeRemoved", t.unreached_func(), true);
+ frame.contentWindow.addEventListener("DOMNodeRemovedFromDocument", t.unreached_func(), true);
+ frame.contentWindow.addEventListener("DOMSubtreeModified", t.unreached_func());
+ frame.contentWindow.addEventListener("DOMSubtreeModified", t.unreached_func(), true);
+ assert_equals(frame.contentDocument.documentElement.localName, "html");
+ assert_equals(frame.contentDocument.open(), frame.contentDocument);
+ assert_equals(frame.contentDocument.documentElement, null);
+ frame.contentDocument.write("<div>heya</div>");
+ frame.contentDocument.close();
+ assert_equals(frame.contentDocument.documentElement.localName, "html");
+ frame.remove();
+}, "document.open(), the HTML parser, and mutation events");