- From: Zambonifofex <notifications@github.com>
- Date: Sun, 12 Jun 2016 11:53:15 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc:
Received on Sunday, 12 June 2016 18:53:42 UTC
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