Re: [css-syntax] At-rules mixed in any declaration list?

On Sat, Apr 20, 2013 at 2:05 PM, Simon Sapin <simon.sapin@exyr.org> wrote:
> Hi,
>
> Should any list of declarations also accept at-rules, like the body of @page
> rules? This potentially affects style rules, style attribute, and various
> at-rules. Even if no at-rules are recognized yet, it makes a difference in
> where a new declaration starts:
>
> Parsed as unknown at-rule followed by a valid declaration:
>
>   @page {
>     @margin-note { /* not supported */ }
>     background: green;
>   }
>
> In CSS 2.1, parsed as a single invalid declaration. The at-keyword instead
> of the expected ident (property name) is an error; the parser recovers at
> the next semi-colon:
>
>   body {
>     @nested h1 { /* not supported */ }
>     background: red;
>   }
>
>
> I think we should make that change for all lists of declarations and get the
> error recovery in place, and not wait until we actually need it (eg. when/if
> we want nested rules inside style rules.) CSS 2.1 did the same for @page: no
> nested at-rule was defined yet, but the syntax still allowed them.

I'm not sure exactly when I added this, and I don't want to go history
trawling to find out, but the Syntax spec already handles at-rules in
declaration lists appropriately.  When we finally define an at-rule
meant to be nested inside a style rule, there won't be any problems on
the core syntax side.

~TJ

Received on Sunday, 19 May 2013 23:49:24 UTC