W3C home > Mailing lists > Public > www-style@w3.org > December 2002

Re: CSS parser recovery

From: Etan Wexler <ewexler@stickdog.com>
Date: Wed, 25 Dec 2002 05:00:26 -0500
Message-ID: <10211473437.20021225050026@stickdog.com>
To: www-style@w3.org, Ian Hickson <ian@hixie.ch>

Ian Hickson wrote to <www-style@w3.org> on 23 December 2002 in
"CSS parser recovery"
(<mid:Pine.LNX.4.21.0212140925590.21095-100000@dhalsim.dreamhost.com>):   

> We already know the syntax isn't valid, that's why we're looking at this
> in the first place.

If the data are not valid according to a specific level of or profile
of CSS, we fall back on the core grammar.  If the data are not valid
according to the core grammar, what we have is not CSS.  The user
agent is then free to take any course of action (or of inaction).

[Tantek Çelik:]

>> The spec allows for (nested) block(s) after an @rule, a selector, and in a
>> value and nowhere else.

[Ian Hickson:]

> Sure. But if you find one there _anyway_, then you have to parse it
> [as] 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.

You are using the prose but ignoring the grammar.  In the core grammar
given in CSS2 (<http://www.w3.org/TR/REC-CSS2/syndata.html>), a
declaration block differs from other blocks.  Its contents are a
series of zero or more semicolon-separated declarations.
Declarations, like Tantek Çelik wrote, may contain blocks only in
their values.  A would-be block just after a would-be property name
stops normal parsing.  Anything, including additional parsing, that
the user agent does after normal parsing is the error recovery chosen
by the user agent.   

-- 
Etan Wexler <mailto:ewexler@stickdog.com>
Received on Wednesday, 25 December 2002 05:35:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:18 GMT