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

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 UTC