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 11:26:01 -0700
Message-ID: <CAAWBYDCtquRbnJ1sHf1MWokD2gvjmJ6nYTKkJ-M7EYeRD7VVAQ@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: Florian Rivoal <florianr@opera.com>, www-style@w3.org
On Wed, May 23, 2012 at 11:11 AM, Ojan Vafai <ojan@chromium.org> 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
>>
>> In the new syntax, it would look something like this:
>>
>> color: $bar //normal
>> color: default-var($bar, red) // default value
>
> This could still be var($bar, red) and var($bar) could still work. $bar
> could just be an alais for it. Any subset of these options for dealing with
> default values seem fine to me.

Hm, good point.  No reason to use an extra-long name if a shorter one will do.


>> color: parent-var($bar) // bar from the parent
>> color: parent-var($bar, red) // bar from the parent, with a default value
>
> The new syntax looks strictly better. It prioritizes making the common case
> more readable (or at least more concise) and easier to use without making
> the less common cases any worse.

That's my argument, yeah.

~TJ
Received on Wednesday, 23 May 2012 18:26:52 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:54 GMT