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

Re: css3-background: grammar issue

From: Yves Lafon <ylafon@w3.org>
Date: Wed, 17 Feb 2010 10:46:50 -0500 (EST)
To: Bert Bos <bert@w3.org>
cc: www-style@w3.org
Message-ID: <alpine.DEB.1.10.1002171025250.9042@wnl.j3.bet>
On Wed, 17 Feb 2010, Bert Bos wrote:

> 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.

I never said the opposite. Just to mention that '/' as an operator in a 
parser that is mostly written for CSS21 is easy to do, but adding an extra 
case for _starting_ 'background' with a '/' is far more painful.

>> <<
>> 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.

Ok, so why is CSS3-background disallowing
background: url("foo.png") / 10em black 10em
and not
background: url("foo.png") 10em black / 10em

There is nothing confusing in those two cases, and the generalisation of 
the simple rule "/ <bg-size>  immediately followed by <bg-position>" into
"<bg-position> must not occur before '/ <bg-size>" seems like a strange 
decision as well. Just saying that 'background' can't start with
'/ <bg-size>' is in the same range of text-based constraint.

>> 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.

So why some CSS3 specs (like image) refers to this appendix G of CSS21?
Please provide a revised grammar, like it was done for mediaqueries, for 

> 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.

Ok, so on that case, a validator should say "you're on your own, it's 
invalid" or be more explicit to guide and help the user? (which leads 
to... what kind of error is it).

Baroula que barouleras, au tiéu toujou t'entourneras.

Received on Wednesday, 17 February 2010 15:46:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:34:33 UTC