Re: Parsing media queries

Henri Sivonen wrote:
> 
> On Nov 14, 2007, at 15:40, fantasai wrote:
> 
>> Henri Sivonen wrote:
>>> I intend to implement media query parsing in isolation of the rest of 
>>> CSS because HTML 5 reuses the media query syntax in attribute values.
>>> A couple of comments about the spec:
>>> It seems to me that whitespace is allowed around tokens. I don't see 
>>> where this is specified. The spec doesn't make a normative reference 
>>> to the CSS3 Syntax module.
>>> It isn't clear how the parser should recover when a query in a list 
>>> fails to parse. Should the parser look for a comma?
>>
>> See http://lists.w3.org/Archives/Public/www-style/2007Nov/0119.html
>> Split on commas and ignore sections you don't recognize.
> 
> 
> Does that mean ignoring for UA processing but counting as errors as far 
> as validation goes?

Yes. A valid media query would have to conform to the syntax given in
the draft (once it's updated to account for whitespace). We probably
should add a statement to that effect.

> As for empty strings, these are all errors, right?
> "all,"
> ",all"
> "print,,screen"
> 
> As Anne pointed out, the whitespace issue still remains.
> 
> Also, are the keywords supposed to be tokenized as idents from CSS3 
> Syntax and then compared against a list of known names or are the key 
> words in theory part of the low level syntax? (I supposed this only 
> makes a difference for what error message would be right.)

No, actually, it would also make a difference as to whether you recognize
CSS-style character escapes. And probably affects case-sensitivity as well.
IMHO mediaqueries should not import CSS character escapes, but should be
case-insensitive.

~fantasai

Received on Wednesday, 14 November 2007 14:47:45 UTC