Re: css3-background: grammar issue

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

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

         ~~Yves

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