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

[css3-mediaqueries] Parsing: @media all and(color) { ... }

From: Shawn Ligocki <sligocki@google.com>
Date: Tue, 18 Dec 2012 16:32:50 -0500
Message-ID: <CACNG_46MFm=V8gWYOzr2LtjANoYGM1RBJq5w1=tJbHXynaqjpQ@mail.gmail.com>
To: www-style@w3.org
Should the following statement be parsable?

@media all and(color) { ... }

and equivalent to:

@media all and (color) { ... }

Where ... are valid rulesets. Notice the lack of space between "and" and
"(color)".

Production rules on http://www.w3.org/TR/css3-mediaqueries/ seems to imply
that the whitespaces are optional:

 media_query
 : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
 | expression [ AND S* expression ]*
 ;

But Webkit and https://github.com/tabatkins/css-parser don't seem to parse
it that way. I'm guessing this is because of the lexer will parses
"and(color)" as a FUNCTION and thus render this as an invalid CSS media
query. https://github.com/tabatkins/css-parser seems to confirm this:

AT(media) WS IDENT(all) WS FUNCTION(and) IDENT(color) )


Is this correct? That this statement should be treated as malformed and
thus ignored (rendered as "@media not all { ... }")?

Thanks,
-Shawn Ligocki
Received on Tuesday, 18 December 2012 21:33:38 GMT

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