declarative-shadow-dom-available-to-element-internals.html (1030B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Declarative Shadow DOM</title> 4 <link rel="author" href="mailto:avandolder@mozilla.com"> 5 <link rel="help" href="https://html.spec.whatwg.org/#parsing-main-inhead:available-to-element-internals"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <custom-element> 10 <template shadowrootmode="open"> 11 </template> 12 </custom-element> 13 14 <script> 15 let elementInternals; 16 customElements.define("custom-element", class extends HTMLElement { 17 constructor() { 18 super(); 19 elementInternals = this.attachInternals(); 20 } 21 }); 22 23 window.onload = () => { 24 test(() => { 25 assert_true(!!elementInternals); 26 assert_true(!!elementInternals.shadowRoot); 27 assert_equals(elementInternals.shadowRoot, document.querySelector("custom-element").shadowRoot); 28 }, "Declarative Shadow DOM: shadow root should be available to element internals"); 29 }; 30 </script>