Skip to content

Commit df443d7

Browse files
committed
[CSS22] Updated for errata s.4.1.1e, about parsing at-rules in declaration lists.
1 parent db041bb commit df443d7

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

css2/syndata.src

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ stylesheet : [ CDO | CDC | S | statement ]*;
149149
statement : ruleset | at-rule;
150150
at-rule : ATKEYWORD S* any* [ block | ';' S* ];
151151
block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*;
152-
ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*;
152+
ruleset : selector? '{' S* declaration-list '}' S*;
153+
declaration-list: declaration [ ';' S* declaration-list ]?
154+
| at-rule declaration-list
155+
| /* empty */;
153156
selector : any+;
154157
declaration : property S* ':' S* value;
155158
property : IDENT;
@@ -475,8 +478,12 @@ a declaration block.
475478
title="declaration block"><dfn>declaration block</dfn></span>
476479
starts with a left curly
477480
brace ({) and ends with the matching right curly brace (}). In between
478-
there must be a list of zero or more semicolon-separated (;)
479-
declarations.
481+
there must be a list of zero or more declarations and at-rules.
482+
Declarations must end with a semicolon (;) unless they are last in the
483+
list.
484+
</p>
485+
<p class=note>Note: CSS level&nbsp;2 has no at-rules that may appear
486+
inside rule sets, but such at-rules may be defined in future levels.
480487
</p>
481488
<p>The <span class="index-def"
482489
title="selector"><em>selector</em></span> (see also the section on <a
@@ -689,11 +696,20 @@ unexpected tokens encountered while parsing a declaration by reading
689696
until the end of the declaration, while observing the rules for matching
690697
pairs of (), [], {}, "", and '', and correctly handling escapes. For
691698
example, a malformed declaration may be missing a property name, colon (:), or
692-
property value. The following are all equivalent:
699+
property value.
700+
701+
<p>When the UA expects the start of a declaration or at-rule (i.e., an
702+
IDENT token or an ATKEYWORD token) but finds an unexpected token
703+
instead, that token is considered to be the first token of a malformed
704+
declaration. I.e., the rule for malformed declarations, rather than
705+
malformed statements is used to determine which tokens to ignore in
706+
that case.
693707

708+
<p>The following are all equivalent:
694709

695710
<pre class="example"><code>
696711
p { color:green }
712+
p { @foo { bar: baz } color:green } /* unknown at-rule */
697713
p { color:green; color } /* malformed declaration missing ':', value */
698714
p { color:red; color; color:green } /* same with expected recovery */
699715
p { color:green; color: } /* malformed declaration missing value */

0 commit comments

Comments
 (0)