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

CSS parser recovery

From: REFSTRUP,JACOB (HP-Vancouver,ex1) <jacob_refstrup@hp.com>
Date: Fri, 13 Dec 2002 12:56:31 -0500
Message-ID: <6D805D4C4567D411AF32009027B6835109810223@xvan02.vcd.hp.com>
To: "www-style (E-mail)" <www-style@w3.org>

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 GMT

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