Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-cascade/layer-stylesheet-multi-adoption.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=target>Test</div>
<script>
test(() => {
let a = new CSSStyleSheet();
a.replaceSync(`@layer { div { color: green; } }`);
let b = new CSSStyleSheet();
b.replaceSync(`@layer { div { color: red; } }`);
document.adoptedStyleSheets = [a, b, a];
assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
});
</script>