[css-cascade-6] Clarify nested scopes and scope proximity · w3c/csswg-drafts@180fce4 (original) (raw)
`@@ -146,13 +146,17 @@ Cascade Sorting Order
`
146
146
` Each declaration has the same specificity as the style rule it appears in.
`
147
147
` The declaration with the highest specificity wins.
`
148
148
``
149
``
`-
`
``
149
`+
`
150
150
`
`
151
``
`-
If two declarations both have elements
`
152
``
`-
selected by scoped descendant relationships
`
153
``
`-
applying [=scoping proximity=],
`
154
``
`-
then the declaration with the fewest generational hops
`
155
``
`-
between the ancestor/descendant element pair wins.
`
``
151
`+
When comparing declarations that appear in style rules
`
``
152
`+
with different [=scoping roots=],
`
``
153
`+
then the declaration with the fewest
`
``
154
`+
generational or sibling-element hops
`
``
155
`+
between the [=scoping root=] and the
`
``
156
`+
[=scoped style rule=] [=subject=] wins.
`
``
157
`+
For this purpose,
`
``
158
`+
style rules without a [=scoping root=]
`
``
159
`+
are considered to have inifinite proximity hops.
`
156
160
``
157
161
`
`
158
162
`
`
`@@ -308,17 +312,14 @@ Effects of ''@scope''
`
308
312
` * The [=cascade=] prioritizes declarations
`
309
313
` with a [=scope proximity|more proximate=] [=scoping root=],
`
310
314
` regardless of specificity or source order
`
311
``
`-
by applying [=scoping proximity=]
`
312
``
`-
between the [=scoping root=] and the [=subject=] of each [=scoped style rule=].
`
313
``
`-
`
``
315
`+
by applying [=scope proximity=]
`
``
316
`+
between the [=scoping root=] and the [=subject=]
`
``
317
`+
of each [=scoped style rule=].
`
314
318
``
315
319
` Note: Unlike Nesting,
`
316
320
` selectors within an ''@scope'' rule
`
317
321
` do not acquire the specificity of any parent selector(s) in the ''@scope'' prelude.
`
318
322
``
319
``
`-
Note: For [[#scope-scope|nested @scope rules]],
`
320
``
`-
only the innermost ''@scope'' matters for determining [=scoping proximity=].
`
321
``
-
322
323
`
`
323
324
` The following selectors have the same specificity (0,0,1):
`
324
325
``
`@@ -334,7 +335,7 @@ Effects of ''@scope''
`
334
335
` is not applied to the specificity of the scoped selector.
`
335
336
` However, since one <{img}> selector is scoped,
`
336
337
` that selector is weighted more strongly in the cascade
`
337
``
`-
with the application of [=scoping proximity=].
`
``
338
`+
with the application of [=scope proximity=].
`
338
339
`
`
339
340
``
340
341
`
`
`@@ -598,11 +599,23 @@ Scope Nesting
`
598
599
``
599
600
`''@scope'' rules can be nested.
`
600
601
` In this case, just as with the nested style rules,
`
601
``
`-
the selectors of the inner ''@scope''
`
602
``
`-
(including those defining its [=scope=])
`
``
602
`+
the prelude selectors of the inner ''@scope''
`
``
603
`+
(those defining its [=scope=])
`
603
604
` are [=scoped selectors|scoped by=]
`
604
605
` the selectors of the outer one.
`
605
606
``
``
607
`+
Note: The resulting [=scope=]
`
``
608
`+
for further nested [=scoped style rules=]
`
``
609
`+
is practically constrained by both
`
``
610
`+
the outer and inner ''@scope'' rules,
`
``
611
`+
but the [=scoping root=] is defined
`
``
612
`+
by the innermost ''@scope''.
`
``
613
`+
Since [=scope proximity=] is measured
`
``
614
`+
between a [=scoped style rule=] [=subject=]
`
``
615
`+
and [=scoping root=],
`
``
616
`+
only the innermost ''@scope'' matters
`
``
617
`+
for determining [=scope proximity=] of [[#scope-scope|nested @scope rules]].
`
``
618
+
606
619
`
`
607
620
` When nesting ''@scope'' rules inside other ''@scope'' rules,
`
608
621
` or inside other selectors,
`
`@@ -704,14 +717,29 @@ Changes
`
704
717
`This appendix is informative.
`
705
718
``
706
719
`
`
707
``
`-
Changes since the 21 December 2021 First Public Working Draft
`
``
720
`+
Changes since the 21 March 2023 Working Draft
`
708
721
``
709
722
` Significant changes since the
`
710
``
`-
21 December 2021 First Public Working Draft include:
`
``
723
`+
21 March 2023 Working Draft include:
`
``
724
+
``
725
`+
- Clarified that [=scope proximity=] is a single measurement of the steps
`
``
726
`+
between a single [=scoping root=] and [=scoped style rule=] [=subject=].
`
711
727
``
712
``
`-
- Removed strong scoping proximity.
`
``
728
`+
- Removed strong scope proximity.
`
713
729
` (Issue 6790)
`
714
730
``
``
731
`+
- Removed the scoped descendant combinator (deferred).
`
``
732
`+
`
``
733
+
``
734
`+
- Added the {{CSSScopeRule}} interface.
`
``
735
`+
`
``
736
+
``
737
`+
`
``
738
`+
Changes since the 21 December 2021 First Public Working Draft
`
``
739
+
``
740
`+
Significant changes since the
`
``
741
`+
21 December 2021 First Public Working Draft include:
`
``
742
+
715
743
` * Clarified ''@scope'' effects on nested '':scope'' and ''&'' selectors.
`
716
744
` (Issue 8377)
`
717
745
``
`@@ -721,18 +749,12 @@ Changes since the 21 December 2021 First Public Working Draft
`
721
749
` * Specified how name-defining [=at-rules=] behave in ''@scope''.
`
722
750
` (Issue 6895)
`
723
751
``
724
``
`-
- Added the {{CSSScopeRule}} interface.
`
725
``
`-
`
726
``
-
727
752
` * Added implicit scopes by making ''<>'' optional.
`
728
753
` (Issue 6606)
`
729
754
``
730
755
` * Disallowed [=pseudo-elements=] in the ''@scope'' prelude.
`
731
756
` (Issue 7382)
`
732
757
``
733
``
`-
- Removed the scoped descendant combinator (deferred).
`
734
``
`-
`
735
``
-
736
758
` * Removed selector scoping notation.
`
737
759
` (Issue 7709)
`
738
760
``