host-functional-descendant-invalidation.html (888B)
1 <!doctype html> 2 <title>CSS Test: element style is correctly updated for rule with :host(..)</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 6 <link rel="help" href="https://drafts.csswg.org/css-scoping/#host-selector"> 7 <div id="host"><div id="slotted"></div></div> 8 <script> 9 test(function() { 10 let root = host.attachShadow({ mode: "open" }); 11 root.innerHTML = ` 12 <style> 13 :host ::slotted(div) { width: 100px; height: 100px; background: red; } 14 :host(.foo) ::slotted(div) { background: green; } 15 </style> 16 <slot></slot> 17 `; 18 assert_equals(getComputedStyle(slotted).backgroundColor, "rgb(255, 0, 0)"); 19 host.classList.add('foo'); 20 assert_equals(getComputedStyle(slotted).backgroundColor, "rgb(0, 128, 0)"); 21 }); 22 </script>