You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 @charsetis no longer a 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, and the behavior of Firefox, Chrome and Epiphany / GNOME 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.
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.
The text was updated successfully, but these errors were encountered:
This change also modifies the mention of @charset as an example of an
at-rule with restrictions on its relative ordering to replace it with
@namespace, since @charset is no longer a valid rule.
Closesw3c#5313.
The definition of when an
@import
rule is valid is:Given that in CSS3
@charset
is no longer a 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, and the behavior of Firefox, Chrome and Epiphany / GNOME 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:
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.The text was updated successfully, but these errors were encountered: