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

Re: how should this invalid CSS be parsed?

From: Christof Hoeke <csad7@t-online.de>
Date: Mon, 05 Nov 2007 20:40:41 +0100
Message-ID: <472F71B9.2060401@t-online.de>
CC: www-style@w3.org

Stewart Brodie wrote:
> Christof Hoeke <csad7@t-online.de> wrote:
> 
>> hi,
>> I have the following CSS
>>
>>      a {x:1}
>>      }
>>      b{y:2}
>>      c{z:3}
>>
>> The specification says (as I remember) that if an error is found it is 
>> resolved with the next valid block.
>>
>> So I thought the CSS above should be equivalent to:
>>
>>      a {x:1}
>>      c{z:3}
>>
>> Browsers on the other hand seem to simple remove the "}" and the CSS 
>> would be equivalent to
>>
>>      a {x:1}
>>      b{y:2}
>>      c{z:3}
>>
>> Which is right (according the specification intend)?
> 
> CSS 2.1 states that the behaviour here is undefined - presumably implying
> that either interpretation is acceptable.
> 
> The old working draft document CSS 3 Syntax claims that the second
> interpretation is required (on the basis of it not being parsable according
> to the grammar, and therefore the fewest characters must be removed).
> 
> Presumably, this particular error can only occur with the '}' character?

I guess the working draft for CSS3 should be changed in this case as 
almost any UA around used the first option?
The longer I am working on a CSS parser (not even renderer) I no longer 
wonder why browsers took (or better take) so long to even comply to CSS 2 ;)

thanks
Chris
Received on Monday, 5 November 2007 19:41:12 GMT

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