layer-stylesheet-multi-adoption.html (727B)
1 <!DOCTYPE html> 2 <link rel="help" href="https://drafts.csswg.org/css-cascade-5/#unnamed-layers"> 3 <link rel="help" href="https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets"> 4 <link rel="help" href="https://issues.chromium.org/issues/462744687"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <div id=target>Test</div> 8 <script> 9 test(() => { 10 let a = new CSSStyleSheet(); 11 a.replaceSync(`@layer { div { color: green; } }`); 12 let b = new CSSStyleSheet(); 13 b.replaceSync(`@layer { div { color: red; } }`); 14 document.adoptedStyleSheets = [a, b, a]; 15 assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)'); 16 }); 17 </script>