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

Re: Malformed declarations incorrectly parsed?

From: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
Date: Wed, 19 Mar 2008 14:54:15 +0000
Message-ID: <47E12917.4020003@googlemail.com>
To: Douglas Perreault CPA* CITP <doug@perreault.us>
CC: www-validator-css@w3.org, 'Yves Lafon' <ylafon@w3.org>

Douglas Perreault CPA* CITP wrote:
> Now you all are confusing me <grin> ...

It is confusing, no doubt about that. :)

> I should think with 
> 
> p { color:red; color:; color:green }
> 
> That the UA should report "color:red", especially because of the statement:
> 
> "Lexical errors are handled with a skip to matching brace"

Just to be clear, that's just a rule made up by the validator developers 
for validation purposes: it directly contradicts the handling mandated 
by the specification in:

http://www.w3.org/TR/CSS21/conform.html#conformance

http://www.w3.org/TR/CSS21/syndata.html#tokenization

http://www.w3.org/TR/CSS21/grammar.html

http://www.w3.org/TR/CSS21/syndata.html#parsing-errors

To boil it down to the essentials: the spec says UAs should parse input 
CSS according to the core CSS grammar. If the input can't be parsed with 
that grammar, then how to handle the input (i.e. the whole stylesheet) 
is undefined in CSS 2.1. If the input can be parsed with that grammar, 
but isn't valid CSS 2.1 (either because it doesn't follow the more 
narrow CSS 2.1-specific grammar or because it uses unknown properties or 
illegal values), then the spec defines some forwards-compatible error 
handling rules, such as ignoring unknown properties and malformed 
declarations.

The example in question was lifted directly from the CSS 2.1 spec, which 
specifies that UAs should treat it as equivalent to:

p {
color : red;
color : green;
}

> It was always my understanding that the UA should read the styles up to the
> point it first comes across an error. From that point on everything else
> should be ignored up to the matching brace.

I'm afraid you're mistaken.

Hope that helps.
--
Benjamin Hawkes-Lewis
Received on Wednesday, 19 March 2008 14:54:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 June 2012 00:14:20 GMT