33 lines
1,000 B
HTML
33 lines
1,000 B
HTML
<!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>
|