Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>@scope - Overlapping scopes with :has(..:scope..) selector</title>
<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>