- From: Simon Sapin <simon.sapin@exyr.org>
- Date: Sun, 21 Apr 2013 14:24:55 +0200
- To: www-style@w3.org
- CC: "Tab Atkins Jr." <jackalmage@gmail.com>, John Daggett <jdaggett@mozilla.com>
Hi, Style rules, style attributes, @viewport rules and nested rules in @keyframes all use a similar formal grammar to define the syntax of property/descriptor declarations. This grammar encodes corner cases like semicolons before the first declaration, consecutive semicolons, and no semicolon after the last declaration: div {; ; background: black;; ;color: white} CSS 2.1 > ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; css-style-attr > declaration-list > : S* declaration? [ ';' S* declaration? ]* > ; css-device-adapt > viewport > : VIEWPORT_SYM S* > '{' S* declaration? [ ';' S* declaration? ]* '}' S*; css-animations > keyframes_blocks: [ keyframe_selector '{' S* declaration? [ ';' S* declaration? ]* '}' S* ]* ; However, @font-face rules, nested rules in @font-feature-values and @counter-style rules are a bit more hand-wavy in the definition of the syntax for declarations. css-fonts > @font-face { <font-description> } > > where <font-description> has the form: > > descriptor: value; > descriptor: value; > [...] > descriptor: value; css-fonts > @font-feature-values <font-family># { > @<feature-type> { > <feature-ident> : <feature-index>+; > <feature-ident> : <feature-index>+; > ... > } > ... > } css-counter-styles > @counter-style <counter-style-name> { > [ descriptor: value; ]+ > } > We all know what that means, but the specs should still have a normative definition of the syntax that encodes all the corner cases. The trends seems to be a formal grammar that extends CSS 2.1 §4.1, but "like declarations in style rules" with a normative reference to CSS 2.1 would work for me too. Alternatively, refer to "parse a list of declarations" in Syntax 3, but see http://lists.w3.org/Archives/Public/www-style/2013Apr/0506.html (Based on http://wiki.csswg.org/spec/cssom-constants , this should be everything that uses the declaration syntax. Not counting @page which allows mixed declarations and at-rules. Did I miss anything?) Bonus question: where is !important allowed? -- Simon Sapin
Received on Sunday, 21 April 2013 12:25:23 UTC