@@ -1017,7 +1017,7 @@ Cascade Sorting Order</h3>
1017
1017
can be explicitly assigned to a [=cascade layer=] .
1018
1018
For the purpose of this step,
1019
1019
any declaration not assigned to an explicit layer
1020
- is added to an implicit first layer.
1020
+ is added to an implicit final layer.
1021
1021
1022
1022
Cascade layers (like declarations) are ordered by order of appearance.
1023
1023
When comparing declarations that belong to different layers,
@@ -1196,27 +1196,27 @@ Cascade Layers</h3>
1196
1196
or relying on source-order to resolve conflicts across layers.
1197
1197
1198
1198
<div class="example">
1199
- For example, the following generates an explicit ''utilities '' layer,
1200
- with higher cascade weight than any un-layered styles:
1199
+ For example, the following generates an explicit ''reset '' layer,
1200
+ with lower cascade weight than any unlayered styles:
1201
1201
1202
1202
<pre class='lang-css'>
1203
- @layer utilities {
1204
- .padding-small {
1205
- /* specificity of 0,1,0 - explicit "utilities" layer */
1206
- padding: 0.25em;
1207
- }
1208
- }
1203
+ audio {
1204
+ /* specificity of 0,0,1 - implicit (final) layer */
1205
+ display: flex;
1206
+ }
1209
1207
1210
- .card > .content {
1211
- /* specificity of 0,2,0 - implicit (first) layer */
1212
- padding: 1em;
1213
- }
1208
+ @layer reset {
1209
+ audio[controls] {
1210
+ /* specificity of 0,1,1 - explicit "reset" layer */
1211
+ display: block;
1212
+ }
1213
+ }
1214
1214
</pre>
1215
1215
1216
- The explicitly layered declarations on <code> .padding-small </code> take precedence
1217
- over the un- layered declarations on the <code> .card > .content </code> element --
1218
- even though the un-layered styles have a higher specificity,
1219
- and come later in the source order.
1216
+ The unlayered declarations on the <{audio}> element take precedence
1217
+ over the explicitly layered declarations on <code> audio [controls] </code> --
1218
+ even though the unlayered styles have a lower specificity,
1219
+ and come first in the source order.
1220
1220
</div>
1221
1221
1222
1222
Name-defining [=at-rules=]
@@ -1467,52 +1467,52 @@ Layer Ordering</h4>
1467
1467
Cascade layers are sorted
1468
1468
by the order in which they first are declared,
1469
1469
with nested layers grouped within their parent layers
1470
- after any unlayered rules.
1470
+ before any unlayered rules.
1471
1471
1472
1472
<div class="example">
1473
1473
Given the following layer rules:
1474
1474
1475
1475
<pre class='lang-css'>
1476
- @layer framework.default {
1477
- strong { font-weight: bold; }
1478
- }
1476
+ /* unlayered styles come last in the layer order */
1477
+ h1 { color: darkslateblue; }
1479
1478
1480
- @layer utilities {
1481
- [hidden] { display: none ; }
1482
- }
1479
+ @layer reset.type {
1480
+ strong { font-weight: bold ; }
1481
+ }
1483
1482
1484
- @layer framework {
1485
- .title { font-weight: 100; }
1483
+ @layer framework {
1484
+ .title { font-weight: 100; }
1486
1485
1487
- @layer theme {
1488
- h1, h2 { color: maroon; }
1489
- }
1490
- }
1486
+ @layer theme {
1487
+ h1, h2 { color: maroon; }
1488
+ }
1489
+ }
1491
1490
1492
- /* unlayered styles come first in the layer order */
1493
- h1 { color: darkslateblue; }
1491
+ @layer reset {
1492
+ [hidden] { display: none; }
1493
+ }
1494
1494
</pre>
1495
1495
1496
1496
The outer layers are sorted first,
1497
1497
with any unlayered style rules
1498
1498
added to an implicit outer layer which
1499
- has lower priority (comes before ) the explicit layers:
1499
+ has higher priority than (comes after ) the explicit layers:
1500
1500
1501
- 1. (implicit outer layer)
1501
+ 1. ''reset''
1502
1502
2. ''framework''
1503
- 3. ''utilities''
1503
+ 3. (implicit outer layer)
1504
1504
1505
1505
Within each layer,
1506
1506
nested layers are sorted in appearance order,
1507
1507
and style rules without further nesting
1508
1508
are similarly added to an implicit sub-layer
1509
- before the explicitly nested layers:
1509
+ after the explicitly nested layers:
1510
1510
1511
- 1. (implicit outer layer)
1512
- 2. ''framework'' (implicit sub-layer)
1513
- 2. ''framework.default''
1511
+ 1. ''reset.type''
1512
+ 2. ''reset'' (implicit sub-layer)
1514
1513
3. ''framework.theme''
1515
- 4. ''utilities''
1514
+ 4. ''framework'' (implicit sub-layer)
1515
+ 5. (implicit outer layer)
1516
1516
</div>
1517
1517
1518
1518
Layers that are defined inside of a [=conditional group rule=]
@@ -1864,8 +1864,9 @@ Changes since the 29 August 2021 Working Draft</h3>
1864
1864
1865
1865
Changes since the <a href="https://www.w3.org/TR/2021/WD-css-cascade-5-20210608/">8 June 2021 Working Draft</a> include:
1866
1866
1867
- * Fixed a missed edit for switching ordering of unlayered styles.
1868
- (See [[#changes-2021-06]] .)
1867
+ * Revert the ordering of unlayered styles.
1868
+ (See [[#changes-2021-06]] and
1869
+ <a href="https://github.com/w3c/csswg-drafts/issues/6284">Issue 6284</a> )
1869
1870
1870
1871
<h3 id="changes-2021-08">
1871
1872
Changes since the 8 June 2021 Working Draft</h3>
0 commit comments