W3C home > Mailing lists > Public > www-style@w3.org > February 2010

Re: css3-background: grammar issue

From: Bert Bos <bert@w3.org>
Date: Wed, 17 Feb 2010 16:21:34 +0100
To: Yves Lafon <ylafon@w3.org>
Cc: www-style@w3.org
Message-Id: <201002171621.34597.bert@w3.org>
On Saturday 09 January 2010 09:11:53 Yves Lafon wrote:
> Hi,
> In this example:
>
> background: /10em
>
> It is parsable according to [CSS21 section 4] but not according to
> the grammar in appendix G

The grammar in appendix G is an approximation of CSS level 2 only. We 
don't have a grammar for level 3, but we do have one for the whole of 
CSS, viz., in chapter 4. The rule above conforms to that grammar.

> <<
> declaration
>
>    : property ':' S* expr prio?
>
>    ;
> expr
>
>    : term [ operator? term ]*
>
>    ;
> operator
>
>    : '/' S* | ',' S*
>
>    ;
>
>
> also, what is the status of
>
> background: / black;
>
> Is it invalid CSS2 at the aprsing level, or invalid CSS3 at the data
> validation level? That can't be decided as there is no CSS version
> indicator.

There is currently no CSS specification that assigns a meaning to it, 
but it conforms to chapter 4, which means it is currently invalid but  
may become valid in the future. Until that time it must be parsed and 
then ignored as described in 4.2 under "illegal values."

>
> There are two possible paths for solving this:
> 1/ disallowing bckground to tart with a <bg-size> (there is already a
> rule forbidding <bg-position> after a <bg-size>, so it's in the same
> range).

There is no reason to disallow it on syntactical grounds, but one could 
argue that it looks confusing. However, I don't think it is a very 
strong argument.

>
> 2/ outlining the grammar change to appendix G in the CSS3 Background
> and Borders document (as in other CSS3 specs when such things occur),
> but it doesn't solve my issue on how to report the error in the CSS
> validator...

Appendix G says explicitly that it contains a grammar for level 2. I 
don't see how we can make it any more explicit.

Whether the validator prints an error for 'background: /10em' depends on 
the profile that the user chose. The declaration is invalid if the 
chosen profile is level 2. But if user chose level 3, or no profile at 
all, then the declaration is valid and there should be no message.

The declaration 'background: / black' gives an error under all profiles. 
It's currently not valid in CSS at all.



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, 17 February 2010 15:21:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT