@@ -212,6 +212,11 @@ Cascade Layers</h3>
212
212
213
213
Issue: [[css-cascade-5#layering]]
214
214
215
+ <h4 id="layer-ordering">
216
+ Layer Ordering</h4>
217
+
218
+ Issue: [[css-cascade-5#layer-ordering]]
219
+
215
220
216
221
<!--
217
222
██████ ██████ ███████ ████████ ████ ██ ██ ██████
@@ -239,13 +244,12 @@ Scoped Styles</h2>
239
244
Each element matched by <<scope-end>> is a [=scoping limit=] .
240
245
The <dfn>scoping limit</dfn> elements define the lower bounds of a scope,
241
246
so that [=scoped selectors=] are not able to match
242
- any elements nested within them.
247
+ any [=scoping limit=] elements,
248
+ or any elements nested within them.
243
249
244
250
Each resulting [=scope=] includes a [=scoping root=] and all its descendants,
245
- up to and including any [=scoping limit=] elements,
246
- but not the descendants of those limits.
247
-
248
- Issue(6577): Inclusive vs exclusive scope boundaries
251
+ up to any [=scoping limit=] elements. [=Scoping limit=] elements and
252
+ their descendants are not included in the [=scope=] .
249
253
250
254
Note: In contrast to [[CSS-SCOPING-1#shadow-dom|Shadow Encapsulation]] ,
251
255
which describes a persistent one-to-one relationship in the DOM
@@ -280,17 +284,16 @@ Scoped Styles</h2>
280
284
For example:
281
285
282
286
<pre class=lang-css>
283
- @scope (.media-object) to (.content) {
287
+ @scope (.media-object) to (.content > * ) {
284
288
img { border-radius: 50%; }
285
-
286
- /* it is also possible to style the lower limit element itself */
287
289
.content { padding: 1em; }
288
290
}
289
291
</pre>
290
292
291
293
The ''img'' selector will only match image tags that are in a DOM fragment
292
294
starting with any ''.media-object'' ,
293
- and including all descendants until any intervening ''.content'' class.
295
+ and including all descendants up to
296
+ any intervening children of the ''.content'' class.
294
297
</div>
295
298
296
299
Issue: Should scoping limits be added to the definition of [=scoped selectors=] ?
@@ -425,31 +428,45 @@ Scoping Styles: the ''@scope'' rule</h4>
425
428
<section data-scope="main-component">
426
429
<p>...<p>
427
430
<section data-scope="sub-component">
428
- <!-- children are only in the inner scope -->
429
431
<p>...<p>
430
432
</section>
431
433
</section>
432
434
</pre>
433
435
434
436
Then the class or attribute can be used
435
- for establishing both upper and lower boundaries,
436
- such that scopes only overlap at those boundaries:
437
+ for establishing both upper and lower boundaries.
438
+ Elements matched by a lower boundary selector
439
+ are excluded from the resulting scope,
440
+ which allows authors to create non-overlapping scopes by default:
437
441
438
442
<pre class=lang-css>
439
443
@scope ([data-scope='main-component'] ) to ([data-scope] ) {
440
444
p { color: red; }
441
445
442
- /* both sections are part of the outer scope */
446
+ /* only the outer section is part of the outer scope */
443
447
section { background: snow; }
444
448
}
445
449
446
450
@scope ([data-scope='sub-component'] ) to ([data-scope] ) {
447
451
p { color: blue; }
448
452
449
- /* the inner section is also part of the inner scope */
453
+ /* the inner section is only part of the inner scope */
450
454
section { color: ghostwhite; }
451
455
}
452
456
</pre>
457
+
458
+ However, authors can use the child combinator
459
+ and universal selector to create scope boundaries that overlap,
460
+ such that the inner scope root is part of both scopes:
461
+
462
+ <pre class=lang-css>
463
+ @scope ([data-scope='main-component'] ) to ([data-scope] > *) {
464
+ p { color: red; }
465
+
466
+ /* both sections are part of the outer scope */
467
+ section { background: snow; }
468
+ }
469
+ </pre>
453
470
</div>
454
471
455
472
''@scope'' rules can be nested.
@@ -597,6 +614,17 @@ Precedence of Non-CSS Presentational Hints</h3>
597
614
<h2 id="changes">
598
615
Changes</h2>
599
616
617
+ This appendix is <em> informative</em> .
618
+
619
+ <h3 id="changes-2022-08">
620
+ Changes since the 21 December 2021 First Public Working Draft</h3>
621
+
622
+ Significant changes since the
623
+ <a href="https://www.w3.org/TR/2021/WD-css-cascade-6-20211221/">21 December 2021 First Public Working Draft</a> include:
624
+
625
+ * [=Scoping limit=] elements are excluded from the resulting [=scope=] .
626
+ (<a href="https://github.com/w3c/csswg-drafts/issues/6577">Issue 6577</a> )
627
+
600
628
<h3 id="additions-l5">
601
629
Additions Since Level 5</h3>
602
630
0 commit comments