W3C home > Mailing lists > Public > www-style@w3.org > February 2009

Re: Issue in CSS21 grammar?

From: Bert Bos <bert@w3.org>
Date: Tue, 24 Feb 2009 21:20:36 +0100
To: Yves Lafon <ylafon@w3.org>, www-style@w3.org
Message-Id: <200902242120.36743.bert@w3.org>
On Tuesday 10 February 2009, Yves Lafon wrote:
> On Tue, 10 Feb 2009, Yves Lafon wrote:
> >>> Shouldn't selector use a production capturing those requirements,
> >>> (something along the line of HASHIDENT = '#' IDENT) instead of
> >>> HASH?
> >>
> >> The grammar in general is a lot more lax than what CSS2.1
> >> requires. Bert will have to give you the long explanation, syntax
> >> isn't my specialty. :)
> Another thing, in the grammar, CLASS is defined as "." IDENT, so
> constructs like ".55ft" are not recognized as a class, and the last
> bullet in [1] can never occur. So should CLASS be "." NAME ?

That section describes some of the errors in CSS1 that we fixed. One of 
those errors is the tokenization of ".55ft". It is indeed true 
that ".55ft" is never a class selector, but if you know CSS1, you might 
think it was. The bullet simply warns against that.

Of course, strictly speaking, it can be omitted. In fact, the whole 
section can. It doesn't define anything that cannot be inferred from 
reading the earlier chapters. But we thought it might be useful to 
highlight some facts that people might not immediately notice.

Also note that class (lowercase) is not a token, but a non-terminal in 
the grammar. It cannot be defined as "." NAME, because there is no NAME 
token in CSS.

(Strictly speaking, there is no "." token either, but we've taken a 
shortcut: it is a DELIM token with the value ".". However, we cannot do 
the same with NAME, it would not be subset of any existing token and it 
would also be ambiguous with IDENT.)

> [1] <http://www.w3.org/TR/CSS21/grammar.html#tokenizer-diffs>

  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 Tuesday, 24 February 2009 20:21:17 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:24 UTC