W3C home > Mailing lists > Public > www-style@w3.org > December 2013

[css-variables] when validity of variable reference syntax is checked

From: Cameron McCormack <cam@mcc.id.au>
Date: Sun, 08 Dec 2013 15:00:28 +1100
Message-ID: <52A3EEDC.4080602@mcc.id.au>
To: www-style list <www-style@w3.org>
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?
Received on Sunday, 8 December 2013 04:01:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:17 UTC