shadowrootadoptedstylesheets-same-document.html (1139B)
1 <!DOCTYPE html> 2 <title>shadowrootadoptedstylesheets only apply if they're from the same document</title> 3 <meta name="author" title="Kurt Catti-Schmidt" href="mailto:kschmi@microsoft.com" /> 4 <link rel='help' href='https://github.com/whatwg/html/pull/11687'> 5 <script src='/resources/testharness.js'></script> 6 <script src='/resources/testharnessreport.js'></script> 7 <style type="module" specifier="foo"> 8 span {color: blue;} 9 </style> 10 <script> 11 const new_document = Document.parseHTMLUnsafe( 12 "<div id='host'>" + 13 "<template shadowrootmode='open' shadowrootadoptedstylesheets='foo'>" + 14 "<span id='test_element'>Test content</span>" + 15 "</template>" + 16 "</div>" 17 ); 18 19 const host = new_document.getElementById("host"); 20 test(function (t) { 21 assert_equals( 22 host.shadowRoot.adoptedStyleSheets.length, 23 0, 24 "The shadowrootadoptedstylesheets attribute will only import stylesheets from the same document into adoptedStyleSheets.", 25 ); 26 27 }, "adoptedStyleSheets is populated from a <template> element's shadowrootadoptedstylesheets attribute via Document.parseHTMLUnsafe."); 28 </script>