W3C home > Mailing lists > Public > www-validator-css@w3.org > March 2008

Malformed declarations incorrectly parsed?

From: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
Date: Fri, 14 Mar 2008 07:40:32 +0000
Message-ID: <47DA2BF0.2070503@googlemail.com>
To: www-validator-css@w3.org

The CSS 2.1 spec defines some rules for parsing malformed declarations:


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 

(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:

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 

Can anyone confirm if this reflects a bug in the validator?

Benjamin Hawkes-Lewis
Received on Friday, 14 March 2008 07:41:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:01:01 UTC