W3C home > Mailing lists > Public > www-style@w3.org > March 2008

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

From: L. David Baron <dbaron@dbaron.org>
Date: Fri, 7 Mar 2008 21:56:11 -0800
To: Anne van Kesteren <annevk@opera.com>, Brad Kemper <brkemper@comcast.net>, Justin Rogers <justrog@microsoft.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <20080308055611.GA18610@ridley.dbaron.org>

On Friday 2008-03-07 21:18 -0800, L. David Baron wrote:
> On Sunday 2008-01-27 13:14 -0800, Brad Kemper wrote:
> > green in Opera only (with ALL subsequent rules seemingly ignored in Safari 
> > and FireFox):
> > @media all {
> >    @
> > }
> > div { color:green; }
> 
> I think this one should produce green; this seems like a bug in
> Firefox.

> On Sunday 2008-01-27 13:40 -0800, Justin Rogers wrote:
> > The @media production rule brings up another question. I read it as:
> > 
> > -- Most interesting of Brad's additional test cases
> > @media all { /* open scope +1 */
> >   @ /* invalid token, go into selector error recovery which looks for a block */
> > } /* close scope from @media */
> > 
> > Because of the last scope closure, it ends the error recovery
> > started at the invalid @ symbol (read as IMHO I think it should
> > end the error recovery since others can certainly beg to differ).
> > All subsequent rules after it should be parsed normally so I would
> > say the DIV should be green.
> 
> Agreed.  I think it's a bug in Firefox that it needs a {} to recover
> from a stray @ inside an @media rule.

Actually, I'm not so sure here.

What Firefox is doing is the following:

@media all {
  /* ok, we're inside an @media rule, so we parse declaration blocks */
@
  /* well, this is the beginning of an invalid selector, so we have
     to parse until we hit the end of the declaration block, that
     is, until we hit an { and then the matching } */
}
  /* not a {, so keep looking for the { to start our declaration block */
  /* ... same for all remaining tokens in the style sheet */

I can't find anything that says what @media rules are supposed to
have in them, but this seems to match the spec, now that I think
about it.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Saturday, 8 March 2008 05:56:44 GMT

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