Re: [css3-syntax] Error handling within known at-rules

Ian Hickson wrote to <mailto:www-style@w3.org> on 4 September 2004 in 
"Re: [css3-syntax] Error handling within known at-rules" 
(<mid:Pine.LNX.4.61.0409041120230.9548@dhalsim.dreamhost.com>):

> On Fri, 3 Sep 2004, Christian Roth wrote:
>>
>> Assuming the following stylesheet:
>>
>> @import "include.css" { color: red } print;
>> .red { color: red; }
>>
>> 1) Should it include "include.css"?
>
> No.

Agreed.

>> 2) Should it include "include.css" only for the print media type?
>
> No.

Agreed.

>> 3) Should the @import rule be ignored completely?
>
> Yes.

Agreed.

>> 4) Should elements of class "red" have red text?
>
> No.

Here I would say "yes". I explain a bit later.

> The rule uses invalid syntax and thus must be ignored.
>
> The rule consists of exactly:
>
>    @import "include.css" { color: red }
>
> ...no more, no less. That's not valid.

It's not just invalid; it's incomprehensible according to what we know 
of @import at-rules. Consider the following example.

     @import url("imported") print, not-valid;

That's not valid either, because there is no medium associated with the 
keyword 'not-valid'. However, the user agent should not ignore the 
whole at-rule. The comma represents logical "or", so the lack of 
knowledge of 'not-valid' is irrelevant. The user agent should ignore 
the unknown medium specification and proceed as usual, importing the 
referenced style sheet for use in print.

> My interpretation is that the sheet consists of:
>
> 1. An invalid @rule: @import "include.css" { color: red }
> 2. An invalid rule: print; .red { color: red; }
>
> Both are dropped.

My interpretation is that the sheet consists of:

1. An invalid and ignorable at-rule: @import "include.css" { color: red 
}
2. Ill-formed, invalid, ignorable inter-rule junk: print;
3. A valid rule set: .red { color: red; }

I don't have a strong preference for my interpretation over Ian's.

Beyond Christian's illuminating example lie questions of how to handle 
many kinds of syntactic errors in at-rules.

-- 
Etan Wexler.

Received on Sunday, 10 October 2004 09:58:36 UTC