css-scoping-shadow-dynamic-remove-style-detached.html (1188B)
1 <!doctype html> 2 <title>CSS Scoping: Invalidation of style data while ShadowRoot is disconnected.</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="author" title="Mozilla" href="https://mozilla.org"> 5 <link rel="help" href="https://drafts.csswg.org/css-scoping"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1612114"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <div id="host"></div> 10 <script> 11 let t = async_test("Invalidation of style data while ShadowRoot is disconnected."); 12 13 let host = document.getElementById("host"); 14 host.attachShadow({ mode: "open" }).innerHTML = ` 15 <style> 16 div { color: red } 17 </style> 18 <div></div> 19 `; 20 assert_equals(getComputedStyle(host.shadowRoot.querySelector("div")).color, "rgb(255, 0, 0)"); 21 host.remove(); 22 host.shadowRoot.querySelector("style").remove(); 23 requestAnimationFrame(t.step_func(function() { 24 requestAnimationFrame(t.step_func_done(function() { 25 document.body.appendChild(host); 26 assert_not_equals(getComputedStyle(host.shadowRoot.querySelector("div")).color, "rgb(255, 0, 0)"); 27 })); 28 })); 29 </script>