Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /custom-elements/revamped-scoped-registry/template.tentative.window.html - WPT Dashboard Interop Dashboard
test(() => {
const template = document.createElement("template");
assert_false(template.hasAttribute("shadowrootcustomelements"));
assert_equals(template.shadowRootCustomElements, "");
template.shadowRootCustomElements = "blah";
assert_equals(template.getAttribute("shadowrootcustomelements"), "blah");
assert_equals(template.shadowRootCustomElements, "blah");
}, "shadowRootCustomElements reflects as string");
test(() => {
const div = document.createElement("div");
div.setHTMLUnsafe(`<div><template shadowrootmode=open shadowrootcustomelements shadowrootserializable></template></div>`);
assert_equals(div.firstChild.firstChild, null);
assert_equals(div.getHTML({ serializableShadowRoots: true }), "<div><template shadowrootmode=\"open\" shadowrootserializable=\"\" shadowrootcustomelements=\"\"></template></div>");
}, "Serializing a ShadowRoot with a null registry");
test(() => {
const div = document.createElement("div");
div.setHTMLUnsafe(`<div><template shadowrootmode=open shadowrootcustomelements shadowrootserializable></template></div>`);
const registry = new CustomElementRegistry();
registry.initialize(div.firstChild.shadowRoot);
assert_equals(div.firstChild.shadowRoot.customElements, registry);
assert_equals(div.getHTML({ serializableShadowRoots: true }), "<div><template shadowrootmode=\"open\" shadowrootserializable=\"\" shadowrootcustomelements=\"\"></template></div>");
}, "Serializing a ShadowRoot with a registry that differs from its host");