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

Re: [css-variables] CSS Variables are a NEW kind of variable

From: Divya Manian <manian@adobe.com>
Date: Thu, 14 Jun 2012 12:49:00 -0700
To: François REMY <fremycompany_pub@yahoo.fr>, Sylvain Galineau <sylvaing@microsoft.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Chris Eppstein <chris@eppsteins.net>
CC: "www-style@w3.org" <www-style@w3.org>
Message-ID: <CBFF8941.2FEE%manian@adobe.com>
On 6/14/12 12:23 PM, "François REMY" <fremycompany_pub@yahoo.fr> wrote:

>CSS user-defined prooperties are CSS properties the same way HTML's data
>attributes are HTML attributes.

No, I do not think they are equivalent! Data attributes are mere vehicles
of declaring a variable that you would want to manipulate from within your
application.

"Custom data attributes are intended to store custom data private to the
page or application, for which there are no more appropriate attributes or
elements." - 
http://developers.whatwg.org/elements.html#custom-data-attribute

CSS variables are used as values for CSS properties. You can't use a html
custom data attribute as a value within HTML markup. You cant do

<img src=data-fancychart-url
data-fancychart-url="http://lolcats.com/bikeshedding-cat.gif">

This completely renders any further comparisons to each other invalid.

>You can find more about this in my 'June 4' summary [1]
>The use cases include things I already mentioned in my previous summary on
>the matter. You should read it.

I have read it and am very grateful for that summary. I am pretty sure
everyone else who keep chiming in have too. Please do not think any of us
consider your views inconsequential (they helped synthesize my views a
lot!). 



> I agree there can be more use-cases we're
>yet to find but I don't see how a user-defined property approach is going
>to 
>hurt them since this is actually how things will work at the
>implementation 
>level. Hiding that behind a layer will not change that fact.

I am not sure what you mean by implementation level. At implementation
level I am pretty sure variables are worked on differently compared to
other properties. The recent commits on the WebKit nightly builds suggest
that to be the case http://trac.webkit.org/changeset/120154

What is "hiding behind a layer"? I do not want CSS Core grammar to mangle
an already well-defined term 'property' with new intents and directions
that it was not designed/defined for.

Here is what would be nice:

1. New term 'variable', 'label', <insert other bikeshedding words> that is
clearly defined in the CSS spec. This way, if CSS requires certain
properties to never accept a variable, we can do so in the spec.

2. Easy to understand/use syntax for defining a variable (including a
default value) and clear articulate functions to either get or set them
(var-get(), var-set(), <I-am-not-a-language-designer-disclaimer>).

3. CSSOM representation that defines how variables can be accessed via
JavaScript.
Received on Thursday, 14 June 2012 19:49:39 GMT

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