Re: [w3c/webcomponents] [idea] Allow HTML Element attributes to accept any type of value, not just strings. (#519)

You can keep then with the same name.
```JavaScript
class MyElement extends HTMLElement
{
    // ...
    attributeChangedCallback(name, o, n)
    {
        if(name === "data-my-attribute")
        {
            this["data-my-attribute"] = JSON.parse(n);
        }
    }
}
```
Or convert then from dash-case to camel-case and vice-versa.

But honestly, I think libraries/frameworks should interact directly with the property instead of with the attribute, having the `attributeChangedCallback` only be used to allow authors to provide a value to the property from HTML.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/519#issuecomment-225453794

Received on Sunday, 12 June 2016 18:53:42 UTC