summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html')
-rw-r--r--testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html33
1 files changed, 33 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html
new file mode 100644
index 0000000000..7f93ac43bd
--- /dev/null
+++ b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-source-from-fragment.tentative.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Node.appendChild: inserting script and source from a fragment</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<video id="media"></video>
+<script>
+const happened = [];
+const media = document.getElementById("media");
+test(() => {
+ const source = document.createElement("source");
+ const script = document.createElement("script");
+ script.textContent = `
+ happened.push(media.networkState);
+ `;
+
+ const df = document.createDocumentFragment();
+ df.appendChild(script);
+ df.appendChild(source);
+
+ assert_array_equals(happened, []);
+ media.appendChild(df);
+ // This is because immediately during DOM insertion, before the
+ // post-insertion steps invoke script, `<source>` insertion invokes the
+ // resource selection algorithm [1] which does this assignment. This
+ // assignment takes place before earlier-inserted script elements run
+ // post-insertion.
+ //
+ // [1]: https://html.spec.whatwg.org/#concept-media-load-algorithm
+ assert_array_equals(happened, [HTMLMediaElement.NETWORK_NO_SOURCE]);
+}, "Empty <source> immediately sets media.networkState during DOM insertion, " +
+ "so that an earlier-running script can observe networkState");
+</script>