W3C home > Mailing lists > Public > www-style@w3.org > November 2008

[CSS 2.1] issue 24: parsing invalid syntax and matching brackets

From: Bert Bos <bert@w3.org>
Date: Wed, 26 Nov 2008 14:36:57 +0100
To: W3C style mailing list <www-style@w3.org>
Message-Id: <200811261436.57372.bert@w3.org>

The WG accepted the proposal[1] to change "declaration" to "statement" 
in http://www.w3.org/TR/CSS21/syndata.html#parsing-errors

   # Malformed declarations. User agents must handle unexpected tokens
   # encountered while parsing a declaration by reading until the end
   # of the declaration, while observing the rules for matching pairs
   # of (), [], {}, "", and '', and correctly handling escapes.

But after reading the resulting text (below), I think it is not right.

   # Malformed statements. User agents must handle unexpected tokens
   # encountered while parsing a statement by reading until the end
   # of the statement, while observing the rules for matching pairs
   # of (), [], {}, "", and '', and correctly handling escapes.

As the examples in 4.2 right after this paragraph show, user agents do 
*not* have to read until the end of the statement. E.g.:

    p { color:red; color:; color:green }

has a malformed declaration in the middle and should be interpreted as

    p { color:red; color:green }

There is no reason to read any further than the second ";".


I think the original issue was how to deal with parentheses in a 
malformed selector, such as

    FOO @BAR({}) {color: red}

The above is guaranteed not to be valid in any future level of CSS, so I 
don't really mind what the error recovery behavior is, but it cannot be 
the one quoted above.

[1] http://lists.w3.org/Archives/Public/www-style/2008May/0252.html



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Wednesday, 26 November 2008 13:37:35 GMT

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