Re: how should this invalid CSS be parsed?

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 UTC