Re: CSS parser recovery

On 12/14/02 1:29 AM, "Ian Hickson" <ian@hixie.ch> wrote:

> On Sat, 14 Dec 2002, Tantek Çelik wrote:
>> 
>> It is very simple, the spec simply provides no allowance for a block on the
>> property side of the colon. [snip]
> 
> The bits you quote explain what the _valid_ syntax is.
> 
> We already know the syntax isn't valid,

Not true.  We know that the portion up to the property _is_valid_, that's
why we're following the specific rules for parsing declarations, rather than
the rules for parsing unknown @rules (and certainly not the rules for
parsing unknown values).

>> Conclusion: 
>> 
>> The spec allows for (nested) block(s) after an @rule, a selector, and in a
>> value and nowhere else.
> 
> Sure. But if you find one there _anyway_, then you have to parse it a
> nested block, because a declaration block is a block, and:
> 
> # A block starts with a left curly brace ({) and ends with the matching
> # right curly brace (}). In between there may be any characters, except
> # that parentheses (()), brackets ([]) and braces ({}) always occur in
> # matching pairs and may be nested.

The specific rules for parsing a declaration block override the generic
rules for parsing a block.  And in a declaration block a property is an
identifier which cannot contain a block, and thus the open brace following
the property name simply causes the declaration to be ignored, without
opening a block.

Tantek

Received on Saturday, 14 December 2002 04:36:04 UTC