Re: [css3-mediaqueries] "not", "only" and "and" as media_type

On Mon, May 27, 2013 at 2:46 AM, L. David Baron <dbaron@dbaron.org> wrote:
> On Wednesday 2012-05-23 04:47 +0800, Kang-Hao (Kenny) Lu wrote:
>> C. Change the spec: "not", "only" and "and" cannot be media_type.
>>
>> == valid ==
>>
>> == invalid ==
>> and [ and (expr) ]*
>> [ not | only ] [ not | only | and ] [ and (expr) ]*
>> [ not | only ] [ and (expr) ]*
>
> I would actually propose a slight modification of (C), which I
> prefer:
>
>   D. Change the spec:  'not', 'only', 'and', and 'or' cannot be
>      media_type.
>
> I think we should reject all four of these keywords (including 'or',
> which is not currently in media queries, but which I'd like to put
> in it along with extending media queries to allow what @supports
> allows, syntax-wise) as reserved words that are not allowed as
> media_type.
>
>
> I also rather dislike (A) since it requires two token lookahead.
> When starting a media query, if the first two tokens are IDENT(not)
> IDENT(and), then the parser needs to look at the following token to
> distinguish the following two valid possibilities:
>   @media not and (color), screen { /* 'not' is the media type */ }
>   @media not and and (color) { /* 'and' is the media type */ }

Given that media types were a legacy mistake, perhaps we have an even
simpler E option: just specify the allowed media types (the current
set) directly in the grammar, and remove any possibility of
extensibility.

~TJ

Received on Tuesday, 28 May 2013 15:42:56 UTC