[go: nahoru, domu]

Skip to content

Commit

Permalink
[css-cascade-6] Clarify @scope effects on :scope and & #8377
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasai committed Mar 2, 2023
1 parent 5548e04 commit a0919d7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion css-cascade-6/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,13 @@ Effects of ''@scope''</h4>
* The [=style rules=] in an ''@scope'' <<stylesheet>>
are [=scoped style rules=].

* The '':scope'' selector is defined to match
the ''@scope'' rule’s [=scoping root=].
The ''&'' selector is defined to represent
the selector representing the [=scoping root=]
(the [=scope-start selector=]),
or else '':scope'' if no selector was specified.

* The [=cascade=] prioritizes declarations
with a [=scope proximity|more proximate=] [=scoping root=],
regardless of specificity or source order
Expand Down Expand Up @@ -381,6 +388,17 @@ Scoped Style Rules</h4>
(This only applies to the [=subject=];
the rest of the selector can match unrestricted.)

* They accept a <<relative-selector-list>> as their prelude
(rather than just a <<selector-list>>).
Such [=relative selectors=]
are relative to '':scope''.

* Any selector in the <<relative-selector-list>>
that does not start with a [=combinator=]
but does [=contain the nesting selector=] or the '':scope'' selector,
is interpreted as a non-[=relative selector=]
(but the [=subject=] must still be [=in scope=] to match).

<h4 id="scope-limits">
Identifying Scoping Roots and Limits</h4>

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

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

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

0 comments on commit a0919d7

Please sign in to comment.