- From: Andreu Botella via GitHub <sysbot+gh@w3.org>
- Date: Sat, 11 Jul 2020 20:13:44 +0000
- To: public-css-archive@w3.org
andreubotella has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-cascade] Clarify when an @import rule is valid == [The definition of when an `@import` rule is valid](https://www.w3.org/TR/css-cascade-4/#at-import) is: >Any `@import` rules must precede all other at-rules and style rules in a style sheet (besides `@charset`, which must be the first thing in the style sheet if it exists), or else the `@import` rule is invalid. Given that in CSS3 `@charset` [is no longer a rule](https://www.w3.org/TR/css-syntax-3/#charset-rule), it's not clear what the interpretation of that sentence would be when the parser finds an invalid rule named `@charset` that hasn't been interpreted as a fallback encoding marker by the input byte stream. [I've run a few tests](https://github.com/andreubotella/css-import-validity-tests), and the behavior of Firefox, Chrome and [Epiphany / GNOME Web](https://wiki.gnome.org/Apps/Web/) (a Webkit representative, since I don't have access to Mac or iOS machines) match: an `@import` rule is valid if every rule before it in the stylesheet is either invalid or an `@import` rule. And this behavior is in fact consistent with [this text in css-syntax](https://www.w3.org/TR/css-syntax-3/#css-stylesheets): >If any style rule is invalid, or any at-rule is not recognized or is invalid according to its grammar or context, it’s a parse error. Discard that rule. But in any case, the language in css-cascade should probably be updated to not refer to `@charset` as a rule and to clarify this, even if the correct behavior can be reasoned out from other specs. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5313 using your GitHub account
Received on Saturday, 11 July 2020 20:13:46 UTC