W3C home > Mailing lists > Public > www-style@w3.org > October 2011

Re: Better Variables through Custom Properties

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 24 Oct 2011 23:16:11 -0700
Message-ID: <CAAWBYDDjiXxYvriQ-VLKUAX-No30jfLvu9jsQQRCBgAWHm-0oQ@mail.gmail.com>
To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Cc: www-style@w3.org
On Mon, Oct 24, 2011 at 10:36 PM, Daniel Glazman
<daniel.glazman@disruptive-innovations.com> wrote:
> Le 25/10/11 01:39, Tab Atkins Jr. a écrit :
>> :root {
>>   data-main-color: #06c;
>>   data-accent-color: #006;
>> }
>> h1 {
>>   color: data(main-color);
>>   border-left: thick solid data(accent-color);
>> }
>
> Looks interesting, benefits from the existing OM, only uses
> forever one prefix. Oh, and finally closes the ridiculous
> mutable/non-mutable religious war that made zillions of us wait for
> more years for variables in CSS. Mutable, period.
>
> So in two words: *really cool*...
>
> What's the value of a data-* property? A single token? Multiple
> tokens ? Think practical for web authors, complexity is ours and
> not their problem.

As I just wrote to Boris, a list of values with any of the valid separators.

(Oh, and an addition to the list for option #2, the restrictive one -
functions and strings.  Basically whatever data types appear in Values
& Units.)

> Can we avoid circular dependencies making it invalid to use data()
> in the value(s) of a data-* property? I don't think we need it anyway.

I think we do need it.  Being able to define values in terms of other
values, particularly when you invoke calc(), or Image Values/Filters,
or a hypothetical extension for Colors 4 that lets you directly
manipulate colors (lighten/saturate/etc), would be pretty useful.
It's possible in SASS, and apparently used to decent effect.

~TJ
Received on Tuesday, 25 October 2011 06:17:10 GMT

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