[css-variables] parse-time error handling in uses of variables

I recently noticed a relatively major omission in
http://dev.w3.org/csswg/css-variables/ :  it doesn't say anything
about the or the error handling for *uses* of variables.

In particular, declarations that use variables in the value are
preserved for later variable substitution, at which point either the
variable substitution works or the declaration is invalid at
computed-value time.

However, the specification doesn't define which declarations get
preserved until computed value time for this process to happen.

I'd like to propose that this preservation (and the resulting
cascading) should happen for any declaration (of any property) that:
 (a) meets all the syntactic requirements for the value of a
     variable property
 (b) contains at least one "var(" function token
 (c) has every "var(" function token followed (through the matching
     ')' token) by syntax that is a valid var() function in this
     level of the specification


For example, this would mean that:
  background: red;
  background: var(undefined-variable);
would produce a transparent background, as would:
  background: red;
  background: var(undefined-variable, bad fallback syntax);
but that:
  background: green;
  background: var(undefined-variable, bad fallback syntax,
                  third argument not in this level of CSS);
would produce a green background since the second declaration would
be thrown out because of point (c).

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Thursday, 6 December 2012 07:29:02 UTC