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

Re: [css-variables] How to spec the OM for vars?

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Sat, 01 Sep 2012 17:01:09 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
Message-Id: <516191346504469@web9g.yandex.ru>
01.09.2012, 04:12, "Tab Atkins Jr." <jackalmage@gmail.com>:
> On Thu, Aug 23, 2012 at 5:46 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
> el.style.var.foo /* equal to el.style.getPropertyValue('var-foo') */
>
> I decided not to do any camelCase to dashes conversion, because it
> wouldn't work if any component of the var name didn't start with an
> ASCII lowercase letter. The shorthand .form only works if your var
> name was a single JS ident, according to normal JS rules. šIf your var
> name doesn't match that, just use the array syntax:
>
> el.style.var['foo-bar'] /* equal to el.style.getPropertyValue('var-foo-bar') */
>
> Is this acceptable? šIf so, we need to re-resolve to publish a WD, as
> this is a major change.

Perfectly acceptable and right way to go for me. In general, I personally very like idea of _not_ performing any conversion and using thing names "as is" instead. (I tend to consider that forcing such conversion in `element.dataset` was a mistake as for spec design.)

Or at least the two could exist in spec simultaneously, i.e. `some-example` variable could be accessed both ways:

    element.style.var.someExample;
    // or
    element.style.var['some-example'];

depending of what one is more usable for specific author.
Received on Saturday, 1 September 2012 13:01:52 GMT

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