Closed
Description
Regarding empty @layer statements, the current spec says:
Such empty @layer rules are allowed anywhere either @import or other @layer rules are allowed.
And also:
Any @import rules must precede all other valid at-rules and style rules in a style sheet (ignoring @charset and empty @layer definitions), or else the @import rule is invalid.
This allows interleaving @layer and @import rules. I'm proposing to disallow it because:
- There doesn't seem to be a valid use case to interleave these two types of rules
- No interleaving makes it much easier to implement in Chromium. Otherwise, we need to maintain the relative ordering between @layer and @import rules in the StyleSheetContents class, which makes it more complicated without getting any benefit
The exact proposal is that rules in a style sheet must follow this ordering:
- @charset
- Empty @layer statements
- @import
- @namespace
- All other rules + empty @layer statements