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

On Saturday 2008-03-08 19:09 -0800, Justin Rogers wrote:
> >>>
> An at-rule consists of everything up to and including the next
> semicolon (;) or the next block, whichever comes first.
> <<<
> 
> @media all { @ }
> div { color: green; }
> 
> I think the sticky point for this test case is what takes priority in
> error recovery. The open parenthesis starts a block which is owned by
> the @media. The closing parenthesis should close the block because it
> is currently the only open block and we found a matching closing
> character. We may do this while we are in error recovery for something
> else like a selector though.

This does make sense to me; I'm fine with changing Mozilla to do this.

I think the way to fix this in the spec would be to make the following
changes:

In section 4.2, change:
  # User agents must ignore an invalid at-keyword together with
  # everything following it, up to and including the next semicolon (;)
  # or block ({...}), whichever comes first.
to say:
  # User agents must ignore an invalid at-keyword together with
  # everything following it, up to and including the next semicolon (;),
  # the next block ({...}), or the end of the block (}) that contains
  # the invalid at-keyword, whichever comes first.

In section 4.1.7, after the following:
  # When a user agent can't parse the selector (i.e., it is not valid
  # CSS 2.1), it must ignore the declaration block as well.
add:
  # If the block containing the selector is closed with a "}" before
  # finding a declaration block, the rule set does not have a
  # declaration block (so the user agent does not need to find one to
  # ignore).

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Thursday, 27 March 2008 18:04:16 UTC