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

On 15/01/2011 6:56 AM, Boris Zbarsky wrote:
> On 1/8/11 8:03 AM, Alan Gresley wrote:

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


Thank you for you reply Boriz. I believe that the below examples should 
be also given in the section on "Unexpected end of style sheet" in 4.2. 
Atm there are just examples for @rule.


Example 1.

   p {
     color: green;
   }
   {
   p {
     color: red;
   }


Example 2.

   p {
     color: green;
   }
   }
   p {
     color: red;
   }



-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo

Received on Wednesday, 19 January 2011 07:02:02 UTC