scope-overlapping-has.html (1000B)
1 <!DOCTYPE html> 2 <title>@scope - Overlapping scopes with :has(..:scope..) selector</title> 3 <link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scope-atrule"> 4 <link rel="help" href="https://issues.chromium.org/issues/383343312"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <style> 8 :where(*) { 9 background-color: green; 10 } 11 @scope (.a) to (.limit) { 12 :scope:has(.b:not(:scope .a *)) .hello { 13 background-color: red; 14 } 15 } 16 </style> 17 <div class=a id=outer> 18 <div> 19 <div class=limit> 20 <div class=a id=inner> 21 <div class=b></div> 22 <div class=hello id=first>hello</div> 23 </div> 24 </div> 25 </div> 26 <div class=hello id=second>hello</div> 27 </div> 28 <script> 29 test(() => { 30 assert_equals(getComputedStyle(first).backgroundColor, 'rgb(255, 0, 0)'); 31 assert_equals(getComputedStyle(second).backgroundColor, 'rgb(0, 128, 0)'); 32 }, ':has() with inner :scope works when scopes overlap'); 33 </script>