Re: Better Variables through Custom Properties

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 UTC