Files
ladybird/Tests/LibWeb/Text/input/wpt-import/custom-elements/registries/global.window.js
Sam Atkins fe3c6a1f9f Tests: Import WPT custom-elements/registries tests
Includes reimporting the test we already had, which has changed
significantly.

Most of these fail, but importing them now to track progress.
2026-03-27 19:49:55 +00:00

28 lines
1.6 KiB
JavaScript

test(() => {
const contentDocument = document.implementation.createHTMLDocument();
assert_throws_dom("NotSupportedError", () => customElements.initialize(contentDocument));
assert_throws_dom("NotSupportedError", () => customElements.initialize(contentDocument.createElement("x")));
}, "initialize() of global registry should throw for nodes from another document");
test(() => {
const contentDocument = document.implementation.createHTMLDocument();
assert_throws_dom("NotSupportedError", () => contentDocument.createElement("div", { customElementRegistry: customElements }));
}, "createElement() should throw with global registry from another document");
test(() => {
const contentDocument = document.implementation.createHTMLDocument();
assert_throws_dom("NotSupportedError", () => contentDocument.createElementNS("x", "div", { customElementRegistry: customElements }));
}, "createElementNS() should throw with global registry from another document");
test(() => {
const contentDocument = document.implementation.createHTMLDocument();
const element = contentDocument.createElement("div");
assert_throws_dom("NotSupportedError", () => element.attachShadow({ mode: "closed", customElementRegistry: customElements }));
}, "attachShadow() should throw with global registry from another document");
test(() => {
const contentDocument = document.implementation.createHTMLDocument();
const element = contentDocument.createElement("div");
assert_throws_dom("NotSupportedError", () => contentDocument.importNode(element, { customElementRegistry: customElements }));
}, "importNode() should throw with global registry from another document");