declarative-with-disabled-shadow.html (1105B)
1 <!DOCTYPE html> 2 <title>Declarative Shadow DOM with shadow disabled</title> 3 <link rel='author' href='mailto:masonf@chromium.org'> 4 <link rel='help' href='https://github.com/whatwg/dom/issues/831'> 5 <script src='/resources/testharness.js'></script> 6 <script src='/resources/testharnessreport.js'></script> 7 8 <body> 9 <script> 10 class ShadowDisabledElement extends HTMLElement { 11 static get disabledFeatures() { 12 return ['shadow']; 13 } 14 } 15 customElements.define('shadow-disabled',ShadowDisabledElement); 16 </script> 17 18 <shadow-disabled> 19 <template shadowrootmode="open"><span id=inside></span></template> 20 </shadow-disabled> 21 22 <script> 23 test(t => { 24 let element = document.querySelector('shadow-disabled'); 25 assert_true(element instanceof ShadowDisabledElement); 26 let template = element.querySelector('template'); 27 assert_true(!!template, 'Declarative shadow attach should fail, since shadow-disabled is true'); 28 assert_true(!element.shadowRoot, 'Shadow root should not be present on custom element'); 29 }, 'Declarative Shadow DOM: declarative shadow should fail if attachShadow() already called'); 30 </script> 31 </body>