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

Re: [CSS21] New Candidate Recommendation - suggested correction to grammar for 'combinator'=whitespace

From: Bert Bos <bert@w3.org>
Date: Wed, 25 Jul 2007 11:54:51 +0200
To: "Cecil Ward" <cecil@cecilward.com>, www-style@w3.org
Message-Id: <200707251154.51937.bert@w3.org>

On Monday 23 July 2007 20:32, Cecil Ward wrote:
> I wish to suggest that the Appendix G Grammar be corrected to avoid
> the difficulties in   interpreting whitespace as a combinator within
> selectors.
>
> The production for "combinatory" currently reads:
>
> combinator
>
>   : PLUS S*
>   :
>   | GREATER S*
>   | S
>
>   ;
>
> I suggest this needs to be amended to read
>
> combinator
>
>   : PLUS S*
>   :
>   | GREATER S*
>   | S+
>
>   ;
>
> CSS3 seems to agree.
>
> I couldn't possibly say, but for all I know this may possibly have
> influenced the fault seen in issue #4870 in the current CSS validator
> - see  http://www.w3.org/Bugs/Public/show_bug.cgi?id=4870 .

Both the Selectors module and appendix G of CSS 2.1 correctly deal with 
comments in selectors, but they do it differently. Maybe the grammar in 
the Selectors module is indeed easier for programmers...

The question is what tokens occur in these two selectors:

    P  P
    P /*comment*/ P

both have two spaces. The first one clearly results in just three 
tokens:

    IDENT S IDENT

The question is if the second one results in three tokens or in four:

    IDENT S S IDENT

Appendix G shows how to remove comments so that the spaces on either 
side of the comment only create a single S token. The grammar in the 
Selectors module instead creates two S tokens.



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, 25 July 2007 09:55:01 GMT

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