Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<title>shadowrootadoptedstylesheets only apply if they're from the same document</title>
<meta name="author" title="Kurt Catti-Schmidt" href="mailto:kschmi@microsoft.com" />
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<style type="module" specifier="foo">
span {color: blue;}
</style>
<script>
const new_document = Document.parseHTMLUnsafe(
"<div id='host'>" +
"<template shadowrootmode='open' shadowrootadoptedstylesheets='foo'>" +
"<span id='test_element'>Test content</span>" +
"</template>" +
"</div>"
);
const host = new_document.getElementById("host");
test(function (t) {
assert_equals(
host.shadowRoot.adoptedStyleSheets.length,
0,
"The shadowrootadoptedstylesheets attribute will only import stylesheets from the same document into adoptedStyleSheets.",
);
}, "adoptedStyleSheets is populated from a <template> element's shadowrootadoptedstylesheets attribute via Document.parseHTMLUnsafe.");
</script>