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
Section 3.1 is Evaluating Media Queries but it does not even define how to evaluate <media-query-list>, <media-query>, <media-type>, but only non top-level subproductions. How to evaluate them is actually defined:
for <media-query-list>: in 2.1 Combining Media Queries with A media query list is true if any of its component media queries are true, and false only if all of its component media queries are false
for <media-query>: in 2. Media Queries with a media query is true if: the media type, if specified, matches the media type of the device where the user agent is running, and the media condition is true.
for <media-type>: in 2.3 Media Types with User agents must recognize the following media types as valid, but must make them match nothing
In my opinion, it would help to have some consistency by using "evaluates to true" instead of "is true", or "must evaluate" instead of "must recognize" or "must match", to make a clear distinction between parsing and evaluating, even if both could apply at the same time.
Each of the major subexpression of <media-condition> or <media-condition-without-or> is associated with a boolean result
It may be obvious to experienced implementers but I am not one of them and how and whenthe major subexpression of <media-condition> or <media-condition-without-or> is associated with a boolean result is not really clear to me, and some general guidance would have been helpfull, like in the introduction of 5. Parsing in CSS Syntax.
I know that evaluating media queries is required at parse time to decide whether the style sheet referenced by @import must be fetched, and at computed value time to filter the declared values (but also as part of the event loop and when running window.matchMedia()). This answers the "when".
I do not think that the result from their evaluation should be assigned as a property of the result from parsing these productions. It would be useless since it would have to be updated each time the definition of the user environment has changed.
MediaQueryList seems like a good fit to make this association: it holds the result from parsing <media-query-list> and returns its evaluation. It could hold an internal state that optimize running an evaluation depending on which media feature of the user environment has changed. But there is no mention of MediaQueryList in the Media Queries spec, except in a note about custom media queries that is obscure to me, so I am not sure about this idea.
The text was updated successfully, but these errors were encountered:
Section 3.1 is Evaluating Media Queries but it does not even define how to evaluate
<media-query-list>
,<media-query>
,<media-type>
, but only non top-level subproductions. How to evaluate them is actually defined:<media-query-list>
: in 2.1 Combining Media Queries with A media query list is true if any of its component media queries are true, and false only if all of its component media queries are false<media-query>
: in 2. Media Queries with a media query is true if: the media type, if specified, matches the media type of the device where the user agent is running, and the media condition is true.<media-type>
: in 2.3 Media Types with User agents must recognize the following media types as valid, but must make them match nothingIn my opinion, it would help to have some consistency by using "evaluates to true" instead of "is true", or "must evaluate" instead of "must recognize" or "must match", to make a clear distinction between parsing and evaluating, even if both could apply at the same time.
It may be obvious to experienced implementers but I am not one of them and how and when the major subexpression of
<media-condition>
or<media-condition-without-or>
is associated with a boolean result is not really clear to me, and some general guidance would have been helpfull, like in the introduction of 5. Parsing in CSS Syntax.I know that evaluating media queries is required at parse time to decide whether the style sheet referenced by
@import
must be fetched, and at computed value time to filter the declared values (but also as part of the event loop and when runningwindow.matchMedia()
). This answers the "when".I do not think that the result from their evaluation should be assigned as a property of the result from parsing these productions. It would be useless since it would have to be updated each time the definition of the user environment has changed.
MediaQueryList
seems like a good fit to make this association: it holds the result from parsing<media-query-list>
and returns its evaluation. It could hold an internal state that optimize running an evaluation depending on which media feature of the user environment has changed. But there is no mention ofMediaQueryList
in the Media Queries spec, except in a note about custom media queries that is obscure to me, so I am not sure about this idea.The text was updated successfully, but these errors were encountered: