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

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 7 Dec 2012 09:10:58 -0800
Message-ID: <CAAWBYDCDviBXa4-Q9HfvaeuK3AftUqHcKXXYi_4RP8QrUFKHAQ@mail.gmail.com>
To: "L. David Baron" <dbaron@dbaron.org>
Cc: www-style list <www-style@w3.org>
On Wed, Dec 5, 2012 at 11:25 PM, L. David Baron <dbaron@dbaron.org> wrote:
> 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).

I'm pretty sure I had text about this, actually.  It must have gotten
lost when I punted parent-var() to the next level.

In any case, I'm in favor.  I'll add a paragraph about this.

(Note that your third example is actually valid - the definition of
<fallback-value> is so broad that it includes DELIM(,) tokens, so the
fallback value is "bad fallback syntax, third argument not in this
level of CSS".)

Received on Friday, 7 December 2012 17:11:46 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:24 UTC