Re: [css-variables] Hidden costs.

On Wed, Feb 16, 2011 at 1:24 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> On 02/16/2011 12:52 PM, Tab Atkins Jr. wrote:
>>
>> On Tue, Feb 15, 2011 at 8:25 PM, Andrew Fedoniouk
>> <andrew.fedoniouk@live.com>  wrote:
>>>
>>> The problem is that no one of Web designers actually asked about exactly
>>> CSS
>>> Variables
>>> (run-time interpretable entities). Except of authors of this bright idea
>>> -
>>> Daniel Glazman et al.
>>> of course. But there are a lot of requests for CSS Constants (parse time
>>> macro variables).
>>> Just note various existing CSS macro/preprocessors and absence of
>>> anything
>>> even close to CSS variables (they can be modeled in principle by JS
>>> means).
>>
>> Actually, they have.  An example given by an internal developer was a
>> table with lots of values, where some cells represented data from one
>> source, other cells represented data from a different source, etc.
>> Based on XHR data, the cells representing a source should all change
>> color in a particular way.
>>
>> Right now the only way to do that is to either (1) loop through the
>> elements, setting the .style directly, or (2) use the OM to directly
>> tweak the color declaration in the stylesheet.
>>
>> Neither is optimal.
>
> I don't understand why the developer is not assigning class values to
> these cells based on where their data is coming from, nor do I understand
> how variables is solving this person's problem.

They are.  Variables help here because they can use the variable in a
declaration block for the class, and then just tweak the var to change
the value.

In effect, the var is acting like a reference into the stylesheet here.

~TJ

Received on Wednesday, 16 February 2011 21:52:41 UTC