summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-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-custom-from-fragment.tentative.html')
-rw-r--r--testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-from-fragment.tentative.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-from-fragment.tentative.html b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-from-fragment.tentative.html
new file mode 100644
index 0000000000..23a050f37e
--- /dev/null
+++ b/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-from-fragment.tentative.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Node.appendChild: inserting script and custom element from a DocumentFragment</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<body>
+<script>
+let customConstructed = false;
+let customConstructedDuringEarlierScript = false;
+class CustomElement extends HTMLElement {
+ constructor() {
+ super();
+ customConstructed = true;
+ }
+}
+test(() => {
+ const script = document.createElement("script");
+ script.textContent = `
+ customElements.define("custom-element", CustomElement);
+ customConstructedDuringEarlierScript = customConstructed;
+ `;
+ const custom = document.createElement("custom-element");
+ const df = document.createDocumentFragment();
+ df.appendChild(script);
+ df.appendChild(custom);
+ assert_false(customConstructed);
+ assert_false(customConstructedDuringEarlierScript);
+ document.head.appendChild(df);
+ assert_true(customConstructed);
+ assert_true(customConstructedDuringEarlierScript);
+}, "An earlier-inserted script can upgrade a later-inserted custom element, " +
+ "whose upgrading is synchronously observable to the script, since DOM " +
+ "insertion has been completed by the time it runs");
+</script>