CSSStyleSheet-constructable-disabled-regular-sheet-insertion.html (959B)
1 <!doctype html> 2 <title>Shouldn't crash / assert when inserting a stylesheet after there are disabled constructable sheets</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="help" href="https://wicg.github.io/construct-stylesheets/"> 5 <script src = '/resources/testharness.js'></script> 6 <script src = '/resources/testharnessreport.js'></script> 7 <div id="host"></div> 8 <script> 9 test(function() { 10 let sheet = new CSSStyleSheet({ disabled: true }); 11 sheet.replaceSync("div { color: red }"); 12 13 let root = document.getElementById("host").attachShadow({ mode: "open" }); 14 root.adoptedStyleSheets = [sheet]; 15 let style = document.createElement("style"); 16 root.innerHTML = ` 17 <style>div { color: green }</style> 18 <div>Should be green</div> 19 `; 20 assert_equals(getComputedStyle(root.querySelector("div")).color, "rgb(0, 128, 0)", "Should insert the sheet at the right position and not crash"); 21 }); 22 </script>