CSS parser recovery

The following CSS stylesheet has a missing "}"; both Win/IE and Opera6
recovers from this; is this expected behaviour - is this what the spec
requires or is this something "extra" that both IE and Opera has decided to
implement? Mozilla doesn't recover - our CSS parser doesn't either.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Syntax errors: missing brace in rule set</title>
<style type="text/css">
p {color: green; /* missing "}" */
q {color: blue;}
samp {color:red;}
</style>
</head>
<body>
<p>this sentence should be green. This quote <q>blue</q>.<samp>this should
be red</samp></p>
</body>
</html>

There isn't anything in the core syntax that tells us that we should recover
- according to the core syntax it is perfectly legal to have "q { color: red
}" inside another pair of "{}".

Should we override the core syntax in this case and treat "{" as an
unexpected symbol when parsing property a declaration; then the following
"}" should match the opening "{" of the ruleset and we would recover like
Win/IE and Opera.

If we do this we will limit ourselves not to be able to have "{}" blocks as
values of properties in the future - but that is probably ok?

Regards,
- Jacob

Received on Friday, 13 December 2002 12:56:39 UTC