- From: Yves Lafon <ylafon@w3.org>
- Date: Fri, 14 Mar 2008 06:30:28 -0400 (EDT)
- To: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
- Cc: www-validator-css@w3.org
On Fri, 14 Mar 2008, Benjamin Hawkes-Lewis wrote:
Benjamin, responses inline:
> The CSS 2.1 spec defines some rules for parsing malformed declarations:
>
> http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
>
> Based on the two CSS grammars and these rules, I would expect that given the
> input:
>
> h1 {color: red;}
> p {font-weight: bold; width: 100em !ie; color: green;}
> em {color: yellow;}
>
> the validator would extract the following CSS:
>
> h1 {
> color: red;
> }
> p {
> font-weight: bold;
> color : green;
> }
> em {
> color: yellow;
> }
>
> since while width: 100em !ie cannot be tokenized as a CSS 2.1 declaration, I
> think it can be tokenized with the core CSS grammar like this:
>
> (ruleset: (selector: (ident: p) (whitespace) ) ('{') (declaration:
> (property: width) (whitespace) (':') (value: (dimension: 100em) (whitespace)
> (delim: !) (ident: ie) ) ) ('}') )
>
> However, the validator drops the entire ruleset, extracting only:
Yes, in case of error, the current behaviour is to skip until a matching
brace. This might be changed in the future, but is part of a more general
discussion about: "Should a _validator_ do error recovery like other UA
like browsers, or not? The same apply for the examples below.
In a way yes, if you want to "correct" the CSS and display what a
"conformant UA" should read from the malformed CSS, however it's not
necessary if the goal is mainly to display errors.
> h1 {
> color: red;
> }
> em {
> color: yellow;
> }
>
> I noticed that the validator doesn't handle some of the examples of malformed
> declarations given in the spec correctly.
>
> (a) p { color:red; color; color:green }
>
>
> (a) p { color:green; color{;color:maroon} }
>
> (c) p { color:red; color{;color:maroon}; color:green }
>
> The validator should have extracted color: red; in (a) and (c) and color:
> green; in (a), (b), and (c), but in fact it extracts no valid CSS
> information.
>
> Can anyone confirm if this reflects a bug in the validator?
>
> --
> Benjamin Hawkes-Lewis
>
>
--
Baroula que barouleras, au tiéu toujou t'entourneras.
~~Yves
Received on Friday, 14 March 2008 10:31:01 UTC