W3C home > Mailing lists > Public > www-style@w3.org > July 2014

Re: [mediaqueries] two syntax items

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 23 Jul 2014 10:11:54 -0700
Message-ID: <CAAWBYDChBMgytYDV+SWOr_5Y+_38EydEosgZUeGz6Uym8O5vaQ@mail.gmail.com>
To: Winston Edmond <wbe@psr.com>
Cc: www-style list <www-style@w3.org>
On Wed, Jul 23, 2014 at 9:15 AM, Winston Edmond <wbe@psr.com> wrote:
> On Mon, Jun 9, 2014 at 1:22 PM, I asked:
>>> 1) Is "()" considered an empty "general expression" whose value is false
>>>    [making "not ()" true], or is it considered a syntax error?
>
> to which "Tab Atkins Jr." <jackalmage@gmail.com> kindly replied:
>> Per the grammar, it's valid and false.  It ends up hitting the
>> <general-enclosed> production.
>
> OK.  I think it'd be worth adding something to that effect in the spec,
> perhaps by adding "@media not () is turned into true" to the list of
> examples in section 3.

Do you really think that's useful?  Implementors should just be
implementing the grammar, in which case that sort of thing is handled
automatically, and we only add examples of invalid syntax for authors
when it's a little tricky and authors might actually hit that case.  I
don't think this is something any author would do normally.

> Speaking of section 3 of "http://dev.w3.org/csswg/mediaqueries4/"
> (3 June 2014 draft), there appears to be a "typo" in this example:
>
> ----------
>
>     @media (example, all,), speech { /* only applicable to speech devices */ }
>     @media &test, screen           { /* only applicable to screen devices */ }
>
>     Both of the above media query lists are turned into not all, speech
>     during parsing, which has the same truth value as just speech.
>
> ----------
>
> The "typo": not "both", since the second is "not all, screen" (or change
> screen => speech in line 2).

Ah, good catch. Fixed (by making them both use "speech").

>>> 2) Re: The section 3 example "@media (example, all,), speech"
>
> [I asked if "split queries on comma" made sense given that the current
> subexpression syntax doesn't allow commas.  TJ explained why not and
> added this fine example:]
>
>> For example, given this markup:
>>
>> @media (example, speech {
>>   foo { color: red; }
>> }
>>
>> The opening paren swallows *the rest of the document* into its block,
>> and then there's a syntax error because @media blocks need a {}-block
>> at their end.
>
>  ... and presumably also a syntax error in the media query expression
> itself because the matching ')' is absent.  Wow.  That'd make a good
> example, too.  :)

Sure, done.

~TJ
Received on Wednesday, 23 July 2014 17:12:46 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:23 UTC