host-slotted-001.html (660B)
1 <!doctype html> 2 <title>CSS Test: :host matches while collecting ::slotted rules</title> 3 <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> 4 <link rel="help" href="https://drafts.csswg.org/css-scoping/#host-selector"> 5 <link rel="match" href="reference/green-box.html"> 6 <p>Test passes if you see a single 100px by 100px green box below.</p> 7 <div id="host"><div></div></div> 8 <script> 9 let root = host.attachShadow({ mode: "open" }); 10 root.innerHTML = ` 11 <style> 12 ::slotted(div) { width: 100px; height: 100px; background: red; } 13 :host ::slotted(div) { background: green; } 14 </style> 15 <slot></slot> 16 `; 17 </script>