layer-slotted-rule.html (772B)
1 <!DOCTYPE html> 2 <title>::slotted rules should be associated with the correct cascade layers</title> 3 <link rel="help" href="https://drafts.csswg.org/css-cascade-5/#layering"> 4 <link rel="author" href="mailto:xiaochengh@chromium.org"> 5 <link rel="match" href="reference/ref-filled-green-100px-square.xht"> 6 <style> 7 #target { 8 width: 100px; 9 height: 100px; 10 } 11 </style> 12 13 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 14 <div id="host"> 15 <div id="target"></target> 16 </div> 17 18 <script> 19 const host = document.getElementById('host'); 20 host.attachShadow({mode: 'open'}).innerHTML = ` 21 <style> 22 @layer { 23 ::slotted(*) { 24 background-color: green !important; 25 } 26 } 27 ::slotted(*) { 28 background-color: red !important; 29 } 30 </style> 31 <slot></slot> 32 `; 33 </script>