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

Re: [css-variables] Using $foo as the syntax for variables

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 23 May 2012 12:54:11 -0700
Message-ID: <CAAWBYDBpZFGALAOZ8evwGhbMa2Uo8OVFrLyVorx95O-aUZOVxg@mail.gmail.com>
To: Eric Meyer <eric@oddbird.net>
Cc: www-style@w3.org
On Wed, May 23, 2012 at 11:56 AM, Eric Meyer <eric@oddbird.net> wrote:
> On Wed, May 23, 2012 at 10:32 AM, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> The only two extensions I know I want right now are (1) the ability to
>> specify a default value to be used when a var is invalid or undefined,
>> and (2) the ability to grab the value of a variable from the parent
>> (the inherited value) rather than from the current element.
>> Under the current syntax, these would look something like this:
>> color: var(bar) // normal
>> color: var(bar, red) // default value
>> color: parent-var(bar) // bar from the parent
>> color: parent-var(bar, red) // bar from the parent, with a default value
> This could potentially be extended further with multiple fallbacks (eg
> font-stacks), or with nesting functions:
> margin: stack($foo, parent($bar), calc($baz + 3em), 20px);

Unfortunately, that's not doable.  Variables can hold any value,
including values that contain commas.  Thus, the fallback can contain
commas as well, and so we can't tell whether a comma is meant to be
part of a fallback value or meant to separate fallback values.  This
is similar to the situation with attr()'s fallback.

Received on Wednesday, 23 May 2012 19:55:01 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:59 UTC