Re: [CSS 2.1] General at-blocks and error recovery

On Jan 27, 2008, at 1:40 PM, Justin Rogers wrote:

> @1 starts error recovery for selectors
> { opens a block of type brace
> [ opens a block of type bracket
> } invalid token
> div { color: green; } /* all still in error recovery. Our top of  
> the token stack is a bracket which we haven’t matched */
>
> Adding a bracket after the closing brace closes the bracket scope,  
> but still does not satisfy the brace scope. The final } in the file  
> after color: green; is where we finally close the scope and error  
> recovery is complete. This means the following file should work:
>
>    @1 { [ } ]
>             div { color:green;}
>                 div  { color: green; } /* The last rule eaten was  
> the first div selector above, while I’m safe */

That makes sense, except that FireFox never recovers from that either  
in my tests. As near as I could tell, no number, combination, or  
placement of closing braces and/or brackets after the first closing  
brace would help FireFox recover (although I didn't spend the time to  
test exhaustively). Perhaps it is a bug then, and maybe just in 3.0b2.


>
> For Brad in regards to IE… I would ask that IE be left out of  
> syntax discussions for now, since the legacy behavior would likely  
> be an impediment to moving forwards. Further, the error recovery is  
> designed around common mistakes people made and not so much around  
> the error recovery as detailed by the spec. Most of which comes  
> from shipping the parser before the spec was complete in most cases  
> and then having to continue to support the bad syntax moving forward.

OK, that's reasonable. I was just curious if IE was able to recover,  
since both IE6 and IE7 seemed to be able to successfully skip past @- 
rules that I've written in the past (including @-rules that were not  
part of its vocabulary).

Not closing a left bracket seems like an easy fumble for an author to  
make.

Received on Sunday, 27 January 2008 22:11:46 UTC