[csswg-drafts] [css-cascade-5] `@layer` preceding `@import` should be valid (#8670)

cdoublev has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-cascade-5] `@layer` preceding `@import` should be valid ==
According to [2. Importing Style Sheets: the `@import` rule](https://drafts.csswg.org/css-cascade-5/#at-import), `@import` can  precede `@layer` statement.

  > Any `@import` rules must precede all other valid at-rules and style rules in a style sheet (ignoring `@charset` and `@layer` statement rules) [...]

But it is not clear if it can be preceded by `@layer` statement (emphasize added):

  > [...] and must not have **any other valid at-rules or style rules** between it and previous `@import rules`

What are these other valid at-rules or style rules? Do they include `@charset` and `@layer` statements? 

I guess `@import` can now be preceded by `@layer` based on [6.4.4.2. Declaring Without Styles: the `@layer` statement at-rule](https://drafts.csswg.org/css-cascade-5/#layer-empty):

  > Such empty `@layer` rules are allowed before `@import` and `@namespace` rules

I would suggest repeating *"(ignoring `@charset` and `@layer` statement rules)"* after *"any other valid at-rules or style rules"*. 

I also think that enumerating *at-rules and style rules* may not seem necessary and may be simplified to *rules*:

  > Any `@import` rules must precede all other valid rules (ignoring `@charset` and `@layer` statement rules) and must not have any other valid rules (ignoring `@charset` and `@layer` statement rules) between it and previous `@import` rules, or else the `@import` rule is invalid.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8670 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 3 April 2023 08:51:03 UTC