Skip to content

Commit a0919d7

Browse files
committed
[css-cascade-6] Clarify @scope effects on :scope and & w3c#8377
1 parent 5548e04 commit a0919d7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

css-cascade-6/Overview.bs

+22-1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ Effects of ''@scope''</h4>
328328
* The [=style rules=] in an ''@scope'' <<stylesheet>>
329329
are [=scoped style rules=].
330330

331+
* The '':scope'' selector is defined to match
332+
the ''@scope'' rule’s [=scoping root=].
333+
The ''&'' selector is defined to represent
334+
the selector representing the [=scoping root=]
335+
(the [=scope-start selector=]),
336+
or else '':scope'' if no selector was specified.
337+
331338
* The [=cascade=] prioritizes declarations
332339
with a [=scope proximity|more proximate=] [=scoping root=],
333340
regardless of specificity or source order
@@ -381,6 +388,17 @@ Scoped Style Rules</h4>
381388
(This only applies to the [=subject=];
382389
the rest of the selector can match unrestricted.)
383390

391+
* They accept a <<relative-selector-list>> as their prelude
392+
(rather than just a <<selector-list>>).
393+
Such [=relative selectors=]
394+
are relative to '':scope''.
395+
396+
* Any selector in the <<relative-selector-list>>
397+
that does not start with a [=combinator=]
398+
but does [=contain the nesting selector=] or the '':scope'' selector,
399+
is interpreted as a non-[=relative selector=]
400+
(but the [=subject=] must still be [=in scope=] to match).
401+
384402
<h4 id="scope-limits">
385403
Identifying Scoping Roots and Limits</h4>
386404

@@ -394,12 +412,15 @@ Identifying Scoping Roots and Limits</h4>
394412
of the stylesheet where the ''@scope'' rule is defined.
395413
(If no such element exists,
396414
then the [=scoping root=] is the [=root=] of the containing [=node tree=].)
415+
Any '':scope'' or ''&'' selectors in <<scope-start>>
416+
are interpreted as defined for its outer context.
397417

398418
: Finding any [=scoping limits=]
399419
:: For each [=scope=] created by a [=scoping root=],
400420
its [=scoping limits=] are set to all elements
401421
that are [=in scope=] and that match <<scope-end>>,
402-
using the [=scoping root=] as the '':scope'' element.
422+
interpreting '':scope'' and ''&''
423+
exactly as in [=scoped style rules=].
403424

404425
<div class=example>
405426
The following selectors have the same specificity (0,0,1):

0 commit comments

Comments
 (0)