W3C home > Mailing lists > Public > www-style@w3.org > January 2003

Re: Fwd: selector grammer

From: Jonny Axelsson <jax@opera.no>
Date: Tue, 21 Jan 2003 08:18:14 +0100
To: www-style@w3.org
cc: alexgeller@web.de
Message-ID: <oprjb88opuiaf507@localhost>

(I'm not in the Working Group, my opinion only)

On Tue, 21 Jan 2003 02:16:58 +0100, Bjoern Hoehrmann <derhoermi@gmx.net> 
wrote:

> The w3c grammer states
> simple_selector:
> : element_name? [ HASH | class | attrib | pseudo ]* S*
> ;
> by which it should be valid and equivalent to: * { font-size:12pt }

> We find an additional semantic constraint in the spec at "5.3 universal
> selector" where is says
> "If the universal selector is not the only component of a simple
> selector, the "*" may be omitted"

> Since this is a grammatical issue they could have written:
> simple_selector:
> : element_name [ HASH | class | attrib | pseudo ]* S*
> | [ HASH | class | attrib | pseudo ]+ S*
> ;

Good catch, but I don't think there should be any room for the Degenerate 
Selector (""), and while the grammar might tempt an interpretation of it 
being equivalent to the Universal Selector ("*"), 5.3 forbids it.

Appendix D states "It is in some sense, however, a superset of CSS2 as this 
specification imposes additional semantic constraints not expressed in this 
grammar.", but as you have well described, it can easily be described in 
the grammar and IMHO should.


> By the original grammer even the following should be valid
> #myid#anotherid { font-size:12pt }
> Under "5.9 ID selectors"

This one I wouldn't worry too much about. By prose CSS is aware of the 
uniqueness of IDs, but there is nothing in CSS to prevent impossible 
selectors like :link:visited, nor is there any need for that. It is like 
selecting triangles with four corners. I see no philosophical or practical 
reasons why a selector that can't return any element should be disallowed.

-- 
Jonny Axelsson,
Web Standards,
Opera Software
Received on Tuesday, 21 January 2003 02:20:33 GMT

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