Re: [css3-mediaqueries] Request for feedback on syntax

"Anne van Kesteren" <> wrote:

> Most implementations follow the HTML4 rules for media. From the few  
> content surveys I've seen so far it does not seem that content relies on  
> the error handling rules. Content uses conforming media queries (mostly  
> 'screen'). This suggests that we can probably completely override what  
> HTML4 said by media queries. (This is what HTML5 currently suggests.) The 

> implication of this would be that "{},all" would not apply in either HTML 

> or CSS because it is a syntax error in both.
> Now there is an open question on whether or not we want to use the CSS  
> parser for media queries used in other languages. This is relevant for  
> whether or not "all and (min-width:1p\x)" should work in HTML, or  
> "x,/**/all".
> The advantage of simply using the CSS parser is that HTML implementations 

> that also support CSS can easily reuse code. Another advantage is that  
> authors can simply copy and paste their media query and that the way media
> queries are treated is predictable.
> The disadvantage is that for non-CSS HTML implementations it would be  
> slightly more complicated to support <link rel=alternate media=print  
> href=print> for instance.
> Any feedback on this?

I like it - it's much easier to implement by just stuffing the values of
media attributes through the CSS parser.

The problem with the current situation is that I need a completely separate
lexer to deal with media attributes (and DOM MediaList objects, for that
matter - where exactly do they fit in with the media queries?).

The other complication with the current situation is that I have to split
the media attribute value on commas first, parse each one individually
(which generates a media query object) and then somehow recombine all the
media query objects correctly, taking into account the error handling and
what empty strings mean in certain situations etc.  In fact, I don't bother
doing this currently anyway, on the basis that it's only erroneous media
query strings that are going to cause problems anyway and they're used in so
few places right now, that it's unlikely to cause difficulties in the short

Stewart Brodie
Software Engineer
ANT Software Limited

Received on Wednesday, 12 December 2007 17:21:48 UTC