Re: [mediaqueries] @media screen and (foo) or (baz)

On Tuesday 2015-03-24 00:42 +0100, Simon Sapin wrote:
> On 23/03/15 20:54, Florian Rivoal wrote:
> >Since the intention is for media types to be phased out, you should
> >not run into this case too often.
> 
> 
> >And when the media type is omitted, I wouldn't want to have mandatory
> >parentheses, nor would I want them when the media type is followed by
> >a media condition made of a single media feature (and that wouldn't
> >be backwards compatible anyway).
> 
> I’m not suggesting requiring parentheses in any of these cases, only is
> cases (the one case, really) that are ambiguous modulo precedence of 'or'
> v.s. 'and'.
> 
> 
> >If you think it is worth special casing the grammar for dealing with
> >the limited case that remains once you've removed that, I am not
> >really opposed to it.
> 
> I don’t have a strong opinion, but since the grammar seemed to be have been
> designed to avoid this kind of ambiguity, I just wanted to bring up this
> corner case that might have been unintentional.

I think parentheses should be required in the particular case of
"[ not | only ]? <media-type> and <media-or>" but not other cases;
it seems like it might be a little bit of a pain to specify and
implement, but I think it probably is worth doing to avoid the
ambiguity.

I think it's actually not that hard to specify; it just means
adding:
  <media-condition-without-or> = 
    <media-not> | <media-and> | <media> | <media-in-parens>
and then changing the existing production to:
  <media-query> = <media-condition>
                  | [ not | only ]? <media-type> [ and <media-condition-without-or> ]?

The <media-in-parens> takes care of allowing the or-ed conditions
inside of parentheses.

-David

[1] http://dev.w3.org/csswg/mediaqueries/#mq-syntax

-- 
π„ž   L. David Baron                         http://dbaron.org/   𝄂
𝄒   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Tuesday, 24 March 2015 01:37:15 UTC