1
0
Fork 0
firefox/testing/web-platform/tests/dom/nodes/insertion-removing-steps/Node-appendChild-script-and-custom-from-fragment.tentative.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

34 lines
1.2 KiB
HTML

<!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>