W3C home > Mailing lists > Public > www-style@w3.org > October 2012

Re: [mediaqueries] Doesn't the spec contains an inexistent token in syntax definition?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 30 Oct 2012 18:47:52 +0100
Message-ID: <CAAWBYDC5CM3ikHraAZTgejk9QTrhBZmAcUVofx4oEDCM_s6=_Q@mail.gmail.com>
To: François REMY <fremycompany_pub@yahoo.fr>
Cc: CSS WG <www-style@w3.org>
On Tue, Oct 30, 2012 at 5:36 PM, François REMY
<fremycompany_pub@yahoo.fr> wrote:
> Hi all,
>
> While I was trying to explain to the guys over Microsoft Connect that
> Internet Explorer should support the ‘calc()’ function in media queries
> arguments (something no browser seems to do right now), I noticed there’s a
> problem with the actual defintion of the syntax of CSS Media Queries.
> Indeed, the spec uses an "expr" token in its "expression" definition :
>
>    media_query
>     : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
>     | expression [ AND S* expression ]*
>     ;
>
>    expression
>     : '(' S* media_feature S* [ ':' S* expr ]? ')' S*
>     ;
>
> but refers to CSS 2.1 Grammar [1] which doesn't seem to define any 'expr'
> token at all. However, the "expr" token is defined in the CSS3-Syntax spec
> [2], but this is a WD spec and it is not referenced by the CSSMQ REC.

It's in the non-normative Appendix G grammar, which is specialized for
2.1: <http://www.w3.org/TR/CSS21/grammar.html>

(Just in case they then argue back that calc() isn't allowed per that
grammar: you *obviously* can't literally follow Appendix G, because it
excludes anything new introduced past 2.1, like the <resolution> type,
which is obviously valid in MQ.)

In the next few months, as I finish out the Syntax draft, I'll define
better grammar tokens for these kinds of things to use, and redefine
the various rule grammars in those terms, so that their grammars can
look more like CSS property grammar than Lex grammar.  (I'd like to
avoid requiring people to worry about whitespace when writing
grammars, for example, as it's commonly gotten wrong.)

~TJ
Received on Tuesday, 30 October 2012 17:48:38 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:02 GMT