Skip to content
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 strategy for range syntax #8998

Open
tbjgolden opened this issue Jun 22, 2023 · 3 comments
Open

[mediaqueries-5] Parsing strategy for range syntax #8998

tbjgolden opened this issue Jun 22, 2023 · 3 comments

Comments

@tbjgolden
Copy link

When parsing a media query for range syntax, I was wondering about how this expression would be expected to be parsed.

(infinite = resolution)

In particular - resolution here is the feature but the parser cannot know that as it sees ident, =, ident and could match either of the top two productions in https://www.w3.org/TR/mediaqueries-5/#typedef-mf-range.

What strategy should a parser use to determine that infinite is not the feature?

A simple check for infinite on the first value? And if so, what happens with:

(infinite = infinite)
@tbjgolden
Copy link
Author

I couldn't find any confirmation of what 'ident's might be used in a range expression, but the syntax suggests that they are valid values in a range expression - is that so and what would be an example value? I've used infinite here because it is mentioned as a valid value for resolution, presumably in a mf-plain, but I'm unsure how idents should be treated as range expression values

@tabatkins
Copy link
Member

...huh, why are we allowing the full <mf-value> there? We should really only be allowing the three numeric types (number, dimension, ratio) in the comparison form.

Agenda+ to fix what I think is an obvious oversight here - we should change the current <mf-value> definition to:

<mf-value> = <ident> | <mf-numeric-value>
<mf-numeric-value> = <number> | <dimension> | <ratio>

and then limit the comparison syntax to only use <mf-numeric-value>.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [mediaqueries-5] Parsing strategy for range syntax, and agreed to the following:

  • RESOLVED: restrict comparison syntax to the mf-numeric-value production, not the mf-value production
The full IRC log of that discussion <dael_> TabAtkins: It was pointed out that the mathematical syntax for MQs, specifically equals, <, >, etc didn't restrict the value very well. You could say resolution = infinite. You need to know too much information to know what's the MQ, what's the keyword
<dael_> TabAtkins: I think it's an oversite
<dael_> TabAtkins: prop is when you use comparision syntax we restrict value to numbers, dimensions, ratios. If you want a keyword you use colon syntax
<dael_> astearns: Opinions?
<dael_> TabAtkins: I think this is just an oversite. It's a mature spec so we need a resolution
<dael_> astearns: Prop?
<fantasai> makes sense to me
<dael_> TabAtkins: Restrict compare syntax to the mf-value production
<dael_> astearns: Objections?
<dael_> Restrict compare syntax to the mf-numeric production
<TabAtkins> restrict comparison syntax to the mf-numeric-value production, not the mf-value production
<dael_> RESOLVED: restrict comparison syntax to the mf-numeric-value production, not the mf-value production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants