- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 9 Dec 2013 16:37:41 +1100
- To: Cameron McCormack <cam@mcc.id.au>
- Cc: www-style list <www-style@w3.org>
On Sun, Dec 8, 2013 at 3:00 PM, Cameron McCormack <cam@mcc.id.au> wrote: > It's not clear to me whether a property value that contains variable > references should have its variable reference syntax checked at specified > value time or at computed value time, and whether certain things should be > considered errors at all. > > Section 3 says: > > A property value containing a variable must be assumed to be valid at > parse time. It is only syntax-checked at computed-value time, after > variable references have been resolved. > > What constitutes a value "containing a variable"? Consider: > > p { color: var(1); } > > Does that contain a variable? It has a var() function, though it doesn't > match the syntax for var() in the spec. Should the property be invalid at > specified value time, since there are no syntactically valid var() > references? > > How about: > > p { color: var(a) var(1); } > > Now there is at least one syntactically valid variable reference, but there > is also one that isn't. Should the "var(1)" be treated as just more tokens > to be stored away and to be parsed at computed value time, or should it > cause the value of 'color' to be invalid at specified value time? It's the > same as: > > p { var-a: var(1); } > > The " var(1)" here matches <any-value>, so should it be valid at specified > value time? > > Similarly for cases like: > > p { color: var(a) var(b,!); } > > which uses "!" invalidly at the top level of an <any-value>. > > > What I ended up implementing was that regular properties that contain any > var() function at all must match the grammar for valid var() functions, in > addition to matching <any-value> overall. So all the cases above would be > invalid at specified value time. > > Can this be clarified in the spec? Ooh, very good catch. Depending on how you interpret things, this is already specified (something isn't a var() function if it doesn't match the grammar), but I'm happy to clarify it. I think I've finally got my laptop fixed just now, so I'll actually be able to make the changes I've been promising to make for the last week soon. ~TJ
Received on Monday, 9 December 2013 05:38:28 UTC