host-nested-001.html (884B)
1 <!doctype html> 2 <title>CSS Test: :host doesn't match nested shadow hosts.</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 <style> 7 #host { 8 width: 100px; 9 height: 100px; 10 } 11 </style> 12 <p>Test passes if you see a single 100px by 100px green box below.</p> 13 <div id="host">FAIL</div> 14 <script> 15 let root = host.attachShadow({ mode: "open" }); 16 root.innerHTML = ` 17 <style> 18 div { 19 background: green; 20 width: 100px; 21 height: 100px; 22 } 23 :host { background: red !important } 24 div:host { background: red !important } 25 </style> 26 <div id="nested-host">FAIL - nested shadow host</div> 27 `; 28 root.getElementById("nested-host").attachShadow({ mode: "open" }); 29 </script>