Skip to content

Commit a0a6e9e

Browse files
authored
[css-cascade-6] Disallow empty scope() functions (#13721)
In the #11237 discussion, we agreed that it makes sense to keep the syntax for scoped imports consistent with layered imports, and while things are mostly consistent already, one inconsistency remains: * `layer()` (with no argument) does not define an anonymous layer. You must use the `layer` keyword for this. * `scope()` (with no argument) *does* define an implicit scope. You can *also* use the `scope` keyword for this. We should tighten this up by disallowing empty `scope()`. With the reference to #scope-limits and its description of roots/limits, I think the correct behavior can be understood well enough from the normative text without further elaboration. However, I added a Note to make it more obvious. Also, it's a bit awkward to have named productions that match empty/arbitrary streams; use an exclamation point (!) to require at least one value for <<scope-boundaries>>. (This has the effect of disallowing empty scope() functions.)
1 parent 48ca237 commit a0a6e9e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

css-cascade-6/Overview.bs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ Importing Style Sheets: the ''@import'' rule</h2>
123123
using the [=scoping roots=] and [=scoping limits=]
124124
as described by [[#scope-limits]].
125125

126-
Using the ''scope'' keyword is equivalent to using
127-
the ''scope()'' function with no arguments.
126+
Note: The ''scope'' keyword behaves like a ''@scope'' rule with an empty prelude,
127+
scoping the imported rules to the [=parent element=] of the [=owner node=]
128+
of the stylesheet containing the ''@import'' rule.
128129

129130
Note: While the [=style rules=] within the imported stylesheet
130131
become [=scoped=],
@@ -658,14 +659,14 @@ Syntax of ''@scope''</h4>
658659
The syntax of the ''@scope'' rule is:
659660

660661
<pre class="prod def">
661-
@scope <<scope-boundaries>> {
662+
@scope <<scope-boundaries>>? {
662663
<<block-contents>>
663664
}
664665
</pre>
665666

666667
with <<scope-boundaries>> defined as:
667668
<pre class="prod def">
668-
<dfn export>&lt;scope-boundaries></dfn> = [ ( <<scope-start>> ) ]? [ to ( <<scope-end>> ) ]?
669+
<dfn export>&lt;scope-boundaries></dfn> = [ [ ( <<scope-start>> ) ]? [ to ( <<scope-end>> ) ]? ]!
669670
</pre>
670671

671672
and where:

0 commit comments

Comments
 (0)