diff --git a/css/css-cascade/scope-overlapping-has.html b/css/css-cascade/scope-overlapping-has.html new file mode 100644 index 00000000000000..542cda044c74b3 --- /dev/null +++ b/css/css-cascade/scope-overlapping-has.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<title>@scope - Overlapping scopes with :has(..:scope..) selector</title> +<link rel="help" href="https://drafts.csswg.org/css-cascade-6/#scope-atrule"> +<link rel="help" href="https://issues.chromium.org/issues/383343312"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + :where(*) { + background-color: green; + } + @scope (.a) to (.limit) { + :scope:has(.b:not(:scope .a *)) .hello { + background-color: red; + } + } +</style> +<div class=a id=outer> + <div> + <div class=limit> + <div class=a id=inner> + <div class=b></div> + <div class=hello id=first>hello</div> + </div> + </div> + </div> + <div class=hello id=second>hello</div> +</div> +<script> +test(() => { + assert_equals(getComputedStyle(first).backgroundColor, 'rgb(255, 0, 0)'); + assert_equals(getComputedStyle(second).backgroundColor, 'rgb(0, 128, 0)'); +}, ':has() with inner :scope works when scopes overlap'); +</script>