Skip to content

Commit 0fff97f

Browse files
authored
[@scope] Allow declarations directly within @scope (#11161)
1 parent 41b102f commit 0fff97f

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

css-cascade-6/Overview.bs

+41-2
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ Syntax of ''@scope''</h4>
438438

439439
<pre class="prod def">
440440
@scope [(<<scope-start>>)]? [to (<<scope-end>>)]? {
441-
<<rule-list>>
441+
<<block-contents>>
442442
}
443443
</pre>
444444

@@ -448,7 +448,10 @@ Syntax of ''@scope''</h4>
448448
used to identify the [=scoping root=](s).
449449
* <dfn><<scope-end>></dfn> is a <<selector-list>> [=selector=]
450450
used to identify any [=scoping limits=].
451-
* the <<rule-list>> represents the [=scoped style rules=].
451+
* the [=qualified rules=] within <<block-contents>>,
452+
as well as any [=nested declarations rules=]
453+
produced by [[#scoped-declarations|scoped declarations]],
454+
represents the [=scoped style rules=].
452455

453456
[=Pseudo-elements=] cannot be [=scoping roots=] or [=scoping limits=];
454457
they are invalid both within <<scope-start>> and <<scope-end>>.
@@ -667,6 +670,39 @@ Issue(10795): Should the scope proximity calculation be impacted by nesting scop
667670
(e.g. within ''@layer'')
668671
are [=scoped style rules|scoped=].
669672

673+
<h4 id="scoped-declarations">
674+
Scoped Declarations </h4>
675+
676+
[=Declarations=] may be used directly
677+
with the body of a ''@scope'' rule.
678+
Contiguous runs of [=declarations=]
679+
are wrapped in [=nested declarations rules=],
680+
which match the [=scoping root=]
681+
with zero [=specificity=].
682+
683+
<div class=example>
684+
<pre highlight=css>
685+
@scope (.foo) {
686+
border: 1px solid black;
687+
}
688+
</pre>
689+
690+
is equivalent to:
691+
692+
<pre highlight=css>
693+
@scope (.foo) {
694+
:where(:scope) {
695+
border: 1px solid black;
696+
}
697+
}
698+
</pre>
699+
</div>
700+
701+
Just like for [=style rules=],
702+
[=declarations=] and child [=rules=]
703+
may be [[css-nesting-1#mixing|mixed]]
704+
within ''@scope''.
705+
670706
<h3 id="preshint">
671707
Precedence of Non-CSS Presentational Hints</h3>
672708

@@ -734,6 +770,9 @@ Changes since the 21 March 2023 Working Draft</h3>
734770
Significant changes since the
735771
<a href="https://www.w3.org/TR/2023/WD-css-cascade-6-20230321/">21 March 2023 Working Draft</a> include:
736772

773+
* Allowed [=declarations=] directly within ''@scope''.
774+
(<a href="https://github.com/w3c/csswg-drafts/issues/10389">Issue 10389</a>)
775+
737776
* The '':scope'' selector can match the [=featureless=] [=shadow host=] when
738777
that host is the [=scoping root=] element.
739778
(<a href="https://github.com/w3c/csswg-drafts/issues/9025">Issue 9025</a>)

0 commit comments

Comments
 (0)