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

Etan Wexler wrote:

> On Fri, 3 Sep 2004, Christian Roth wrote:
>>
>> Assuming the following stylesheet:
>>
>> @import "include.css" { color: red } print;
>> .red { color: red; }
[...]
>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; }

As to 2. : Where is defined in the spec what ill-formed, invalid,
ignorable inter-rule junk is? CSS21 4.1.4 [1] states:

"A CSS style sheet, for any version of CSS, consists of a list of
statements (see the grammar above). There are two kinds of statements:
at-rules and rule sets."

Stylesheets (note the "any version" clause) consist of two types of
rules: at-rules and rule sets. 

"print;" must be the start of a rule-set since obviously, it isn't an at-
rule. This means that "print; .red" is to be considered the selector part
[2], "{ color: red; }" the respective declaration-block.

Now, since "print; .red" cannot be parsed as a selector, the following
requirement holds true [2]:

"When a user agent can't parse the selector (i.e., it is not valid
CSS 2.1), it must ignore the {}-block as well."

This leaves us with the only possible interpretation of the resulting
stylesheet as the empty stylesheet (see also the same interpretation by
Ian Hickson, [3]). 

(This implies, btw., that the W3C CSS Validator does not follow the spec
here - already reported).

[1] <http://www.w3.org/TR/CSS21/syndata.html#q7>
[2] <http://www.w3.org/TR/CSS21/syndata.html#q10>
[3] <http://www.w3.org/mid/Pine.LNX.4
.61.0409041120230.9548@dhalsim.dreamhost.com>

Regards, Christian.

Received on Monday, 11 October 2004 09:48:49 UTC