global.window.js (1664B)
1 test(() => { 2 const contentDocument = document.implementation.createHTMLDocument(); 3 assert_throws_dom("NotSupportedError", () => customElements.initialize(contentDocument)); 4 assert_throws_dom("NotSupportedError", () => customElements.initialize(contentDocument.createElement("x"))); 5 }, "initialize() of global registry should throw for nodes from another document"); 6 7 test(() => { 8 const contentDocument = document.implementation.createHTMLDocument(); 9 assert_throws_dom("NotSupportedError", () => contentDocument.createElement("div", { customElementRegistry: customElements })); 10 }, "createElement() should throw with global registry from another document"); 11 12 test(() => { 13 const contentDocument = document.implementation.createHTMLDocument(); 14 assert_throws_dom("NotSupportedError", () => contentDocument.createElementNS("x", "div", { customElementRegistry: customElements })); 15 }, "createElementNS() should throw with global registry from another document"); 16 17 test(() => { 18 const contentDocument = document.implementation.createHTMLDocument(); 19 const element = contentDocument.createElement("div"); 20 assert_throws_dom("NotSupportedError", () => element.attachShadow({ mode: "closed", customElementRegistry: customElements })); 21 }, "attachShadow() should throw with global registry from another document"); 22 23 test(() => { 24 const contentDocument = document.implementation.createHTMLDocument(); 25 const element = contentDocument.createElement("div"); 26 assert_throws_dom("NotSupportedError", () => contentDocument.importNode(element, { customElementRegistry: customElements })); 27 }, "importNode() should throw with global registry from another document");