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

Re: @media all minified?

From: Bert Bos <bert@w3.org>
Date: Wed, 9 Jul 2008 17:59:04 +0200
To: "www-style@w3.org" <www-style@w3.org>
Message-Id: <200807091759.04768.bert@w3.org>

On Wednesday 09 July 2008 17:06, Boris Zbarsky wrote:
> see wrote:
> > just checked the CSS grammar again, the tokenizer is defined here
> > as:
> >
> >     @{M}{E}{D}{I}{A}    {return MEDIA_SYM;}
> >
> > Safari seems to be working right here then?
>
> If you cannot create @-rules whose name starts with "media", that
> seems like a bug in the grammar to me.
>
> So either there is a bug in webkit here, or a bug in the grammar, but
> in either case I would not expect "@mediall { ... }" to act like
> "@media all { ... }".

There are two grammars in the CSS 2.1 spec: the generic CSS grammar and 
a grammar that describes just CSS 2.1. To tokenize a CSS file, only the 
first one is correct.

The second one is only useful on a file that you already know to be 
nothing but CSS 2.1. It will not parse CSS3 features, such as 
@namespace or [foo^=bar] correctly, even though a CSS 2.1 
implementation is required to parse (and ignore) them.

Both "@media" and "@mediaall" are ATKEYWORDs in CSS. The former has a 
defined meaning in level 2 and higher, the latter is not yet defined in 
CSS. All implementations must therefore skip it, together with the 
block that follows. If WebKit doesn't do that, it has a bug.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 9 July 2008 15:59:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT