Re: [css-variables] do we need to have the CSSVariableMap at all?

On Thu, Feb 6, 2014 at 2:42 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> Hi,
>
> I'm wondering whether we need to have the CSSVariableMap at all.  What does
> it make easier that you can't do by interacting with the declaration object
> itself?  To look up and set individual variables, you can do
> decl.setProperty("var-x", "something") and decl.getPropertyValue("var-x").
>
> The CSSVariableMap would make it easier to get an iterator for the
> variables, but I'm struggling to see when you'd want to do that.

When you're using "var-" as an author prefix for piping around custom
CSS properties, rather than using custom properties as variables, the
ability to iterate the variables on an element is invaluable.

(There are other possible ways to expose this, which are perhaps even
better - maybe expose a way to query the document for all elements
with a particular custom property set on them? I'm open to
reconsidering this.)

Plus, being able to say "el.style.var.foo" is just way more convenient
than "el.style.getPropertyValue('var-foo')".  It's weird that you have
to resort to the annoying explicit methods for variables, just because
they're not camel-caseable like the other properties.

~TJ

Received on Thursday, 6 February 2014 23:58:12 UTC