Re: [CSS21] WD 4.1.6, 4.2: parsing of blocks

On 1/8/11 8:03 AM, Alan Gresley wrote:
> On 8/01/2011 8:58 AM, Boris Zbarsky wrote:
>> It's not clear to me how one would even get any of those three tokens,
>> given the end-of-stylesheet rules (which are applied before the
>> tokenizer runs as far as I can tell; that's the only way they make any
>> sense at all). Am I missing something?
>
> I don't know. What is 'end-of-stylesheet rules'?

CSS2.1 section 4.2, search for "Unexpected end of style sheet".  We 
should add some IDs to those things or something so we can just link to 
them....

> but in this malformed statement shows the color as red.
>
> p {color: red; font-weight: bold }
> p {background:yellow
> }{ p {color: red }
> { p {color: green }
> }{} p {color: blue; font-weight: bold }
>
>
> { { } { { } } { }
>
>
> I can't see why this later one should not be blue.

There's no problem with parsing the first two lines.  Then we hit a '{' 
in a context where we didn't expect it, so we start looking for the end 
of the statement, while matching braces/brackets/parens.  So the end of 
the statement can't happen before the corresponding '}'.  In this case 
that never gets found, actually; we hit end of stylesheet first.  So 
everything after that first '{' in line 3 is ignored.

-Boris

Received on Friday, 14 January 2011 19:56:36 UTC