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

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

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 5 Dec 2012 23:25:28 -0800
To: www-style@w3.org
Message-ID: <20121206072528.GA25161@crum.dbaron.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:03 GMT