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 20:56:57 +0100
To: Yves Lafon <ylafon@w3.org>, www-style@w3.org
Message-Id: <200902242056.57439.bert@w3.org>
On Tuesday 10 February 2009, Yves Lafon wrote:
> On Mon, 9 Feb 2009, fantasai wrote:
> > Yves Lafon wrote:
> >> So the text and the grammar are not synchronized.
> >>
> >> 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. :)
> I completely agree that a grammar is not the place to enforce all the
> special cases of the specification, there are constraints that can't
> be expressed in the grammar, but in this specific case, I can't
> imagine a selector being a HASH and not a HASHIDENT (as specified by
> '#' IDENT )
> If HASHIDENT is not needed, then IDENT is not needed, and we should
> move all the IDENT to NAME and put the constraint in the text of the
> spec :) Cheers,

It's probably an improvement to add "except for IDs" to 4.1.3[1], 
changing the text in the second bullet from

    they cannot start with a digit, or a hyphen followed by a digit.
    except for IDs, they cannot start with a digit, or a hyphen followed
    by a digit.

Why should UAs reject "#-2bar"? It is just extra work. Especially if you 
consider the following rule:

    #112233, p { color: #112233 }

which the UA would have to reject, because the first HASH tokens is used 
in the role of an ID.

I believe the intention of the text in that 2nd bullet of 4.1.3 was 
simply to explain the meaning of the grammar, not to impose extra 
parsing rules. My change (above) tries to make it so.

[1] http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#characters

  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 19:57:33 UTC

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