ShadowRoot-init-declarative.html (1050B)
1 <!doctype html> 2 <title>Scoped Custom Element Registries: declarative shadow root</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <div id="host"> 6 <template shadowrootmode="open" shadowrootcustomelementregistry> 7 <custom-element></custom-element> 8 <div></div> 9 </template> 10 </div> 11 <script> 12 test(() => { 13 const customElement = host.shadowRoot.firstElementChild; 14 assert_equals(customElement.customElementRegistry, null); 15 customElement.attachShadow({ 16 mode: "open" 17 }); 18 assert_equals(customElement.shadowRoot.customElementRegistry, null); 19 }, "Custom element inside 'shadowrootcustomelementregistry' declarative shadow root"); 20 21 test(() => { 22 const divElement = host.shadowRoot.lastElementChild; 23 assert_equals(divElement.customElementRegistry, null); 24 divElement.attachShadow({ 25 mode: "open" 26 }); 27 assert_equals(divElement.shadowRoot.customElementRegistry, null); 28 }, "Built-in element inside 'shadowrootcustomelementregistry' declarative shadow root"); 29 </script>