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

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.

-- 
Simon Sapin

Received on Saturday, 20 April 2013 21:05:46 UTC