Re: css3-background: grammar issue

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 UTC