-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mediaqueries-5] Parsing <media-query-list>
when the input is <whitespace-token>
#9173
Comments
You're mistaken. For the purpose of grammar parsing, whitespace is always ignored, unless there's prose specifically defining that it is significant in some way. So in This is implied by https://drafts.csswg.org/css-values/#component-whitespace, tho it could perhaps be a little clearer. |
Ah ok, thanks. I would be happy if it was defined that when parsing a grammar, there is no guarantee that the input does not come with a leading or a trailing whitespace. Or if they were always consumed (in consume an at-rule and consume a list of component values) before parsing a grammar. Currently they seems to be consumed only in consume a declaration, not for |
Hm, I could probably do with some more specificity around that, yeah. Marking this for Syntax rather than MQ. |
Fwiw, I think leading and trailing whitespaces can be removed from any list of component values (prelude, declaration value, etc) in consume a list of component values, which is a better separation of concerns imo. Consume a list of component values
Consume a declaration Steps 4 and 5 are replaced with:
Consume a qualified rule
Consume an at-rule
Basically, it would be invoked with an optional list of stop tokens (without the
|
This is a follow-up of #7040, which reports an issue when parsing a whitespace against
<media-query-list>
.If I am not mistaken, in
@media {}
, the input would be the<whitespace-token>
between@media
and{}
.https://drafts.csswg.org/mediaqueries-5/#typedef-media-query-list
https://drafts.csswg.org/css-syntax-3/#parse-a-comma-separated-list-of-component-values
If I am not mistaken,
groups
contains<whitespace-token>
as its unique item, which is parsed against<media-query>
, which returns an invalid result.https://drafts.csswg.org/mediaqueries-5/#error-handling
If I am not mistaken, the invalid result in
groups
is replaced bynot all
.In Chrome/FF:
Indeed, their behavior conforms to the spec:
Before this resolution to preserve invalid media queries, I would have suggested to parse
<media-query-list>
with parse a comma-separated list according to a CSS grammar, which handle whitespaces by returning an empty list. But it also replaces comma-separated values by the result from their parse against the given grammar (<media-query>
): invalid media queries are lost at this step.I also feel like whitespaces between an at-rule name and its prelude should be consumed in consume an at-rule (like whitespaces between a declaration name and value), and that the prelude of
@media
should be defined with<media-query-list>?
.The text was updated successfully, but these errors were encountered: