- From: Simon Sapin <simon.sapin@exyr.org>
- Date: Sun, 14 Apr 2013 16:00:44 +0200
- To: "www-style@w3.org" <www-style@w3.org>
Hi, The "Values" line for custom properties is defined as: [ <value> | <CDO> | <CDC> ]+ Where <value> is defined in the CSS 2.1 core grammar: > stylesheet : [ CDO | CDC | S | statement ]*; > statement : ruleset | at-rule; > at-rule : ATKEYWORD S* any* [ block | ';' S* ]; > block : '{' S* [ any | block | ATKEYWORD S* | ';' S* ]* '}' S*; > ruleset : selector? '{' S* declaration? [ ';' S* declaration? ]* '}' S*; > selector : any+; > declaration : property S* ':' S* value; > property : IDENT; > value : [ any | block | ATKEYWORD S* ]+; > any : [ IDENT | NUMBER | PERCENTAGE | DIMENSION | STRING > | DELIM | URI | HASH | UNICODE-RANGE | INCLUDES > | DASHMATCH | ':' | FUNCTION S* [any|unused]* ')' > | '(' S* [any|unused]* ')' | '[' S* [any|unused]* ']' > ] S*; > unused : block | ATKEYWORD S* | ';' S* | CDO S* | CDC S*; > > The "unused" production is not used in CSS and will not be used by > any future extension. It is included here only to help with error > handling. I’m a bit confused as to what this means exactly. Is <declaration> extended to allow CDO and CDC? Is <unused> allowed in spite of being … "not used"? Are CDO and CDC allowed inside a {} block? Is a declaration-level ';' token allowed? var-foo: <!-- bar -->; var-foo: [@bar]; var-foo: [{}]; var-foo: [;]; @supports (var-foo: bar;baz) {} var-foo: [<!-- bar -->]; var-foo: {<!-- bar -->}; var-foo: /* unmatched */ )]}; var-foo: url("bar" bad url); var-foo: bar "Bad string: unquoted newline ; var-foo: bar /* Bad comment not closed until EOF Even if such corner cases would never be valid in a "real" property through var(), they make a difference in which custom properties are available through CSSStyleDeclaration. I’d be more comfortable with a negative definition. Something like: "any sequence of tokens except BAD_STRING, BAD_URL, BAD_COMMENT[1], unmatched ')', unmatched ']', and unmatched '}'." [1] Not sure about BAD_COMMENT as Syntax 3 makes all comments valid, even unclosed. A definition based on Syntax 3 (which defines precisely how any character sequence is parsed into a tree of "component values") would be even better, but I understand that Syntax 3 might not be mature enough to be referenced from Variables which we want to progress fast. I’m not asking for a change here, only clarification. I hope this will not delay the spec going to LC and CR. -- Simon Sapin
Received on Sunday, 14 April 2013 14:01:07 UTC