Re: Fwd: selector grammer

(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 UTC