mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests [css-nesting] Support nested @layer rules This CL adds support for nested @layer rules, using the same boilerplate we use for other rules (@media, etc). This was not part of the initial release of css-nesting, because it was added to the specification too late in the process. However, the intent of the spec is to allow nesting of all at-rules that contain style rules in their body [1]. Renamed AllowedRulesType::kConditionalGroupRules to kNestedGroupRules, since it's not just conditional rules that are allowed to nest anymore. [1] https://drafts.csswg.org/css-nesting/#nested-group-rules Fixed: 1455887 Bug: 1451088 Change-Id: I76a9463442bec3e7e6425ddc851ddbf14690604b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4624568 Reviewed-by: Steinar H Gunderson <[email protected]> Commit-Queue: Anders Hartvoll Ruud <[email protected]> Cr-Commit-Position: refs/heads/main@{#1160192} -- wpt-commits: ac7d2531184610cced5432fdcfdf2564ab54f053 wpt-pr: 40616
53 lines
1.1 KiB
HTML
53 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<title>Nested @layers</title>
|
|
<link rel="help" href="https://drafts.csswg.org/css-nesting/#nested-group-rules">
|
|
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#layering">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
|
|
.a {
|
|
/* This should have no effect. Only at-rules containing style rules
|
|
are vaild when nested. */
|
|
@layer theme, base;
|
|
}
|
|
|
|
/* The theme layer wins over the base layer. */
|
|
@layer base, theme;
|
|
|
|
.a {
|
|
@layer theme {
|
|
& {
|
|
z-index: 1;
|
|
}
|
|
|
|
.b {
|
|
background-color: green;
|
|
}
|
|
}
|
|
}
|
|
|
|
@layer base {
|
|
.a {
|
|
z-index: 0;
|
|
}
|
|
.a .b {
|
|
background-color: red;
|
|
}
|
|
}
|
|
</style>
|
|
<main>
|
|
<div class="a">
|
|
<div class="b">
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<script>
|
|
test(() => {
|
|
let a = document.querySelector("main > .a");
|
|
let b = document.querySelector("main > .a > .b");
|
|
assert_equals(getComputedStyle(a).zIndex, "1");
|
|
assert_equals(getComputedStyle(b).backgroundColor, "rgb(0, 128, 0)");
|
|
}, '@layer can be nested');
|
|
</script>
|