Re: CSS core syntax: Why is selector optional?

On Tuesday 08 February 2005 17:36, Christian Roth wrote:
> In the core syntax [1] (so this holds true for both CSS21 and CSS3),
> the selector part of a ruleset is optional:
>
> ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}'
> S*;
>
> However, none of the different specific grammars for selectors (i.e.
> neither the one for  CSS21 [2] nor for CSS3 [3]) actually allow a
> selector to be empty.

I don't remember the original arguments, but I think it was the correct 
thing to do.

I don't know of any proposals to assign a meaning to a selector-less 
rule, but that's no reason to exclude such a rule for all time. Maybe 
we'll find some application in the future, for something else than 
styling.

Meanwhile, it doesn't seem to have any negative effect. On the contrary: 
a selector-less rule is parsed and ignored. That's one less opportunity 
for a parsing error.

>
> [1] <http://www.w3.org/TR/CSS21/syndata.html#tokenization>
> [2] <http://www.w3.org/TR/CSS21/grammar.html>
> [3] <http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#grammar0>
> [4] <http://www.w3.org/TR/CSS21/syndata.html#q10>


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, 16 February 2005 18:57:52 UTC