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

Suppose we want to use SkateJS (with Preact). Now we're using a library (like many others) where handing data to inner components is done by passing data through attributes of inner components. How do we pass numerical values to the inner elements? With custom elements (and considering [Preact passes values into `setAttribute` verbatim](https://github.com/developit/preact/blob/33fc697ac11762a1cb6e71e9847670d047af7ce5/src/dom/index.js#L88), [unlike React](https://github.com/facebook/react/issues/10070)), this is possible because we can override `setAttribute` in order to handle non-string values.

This is really good because we can do performance optimization like that! Some have proposed that non-string values should be set on properties of the element, but this would be a convention, and not standard and idiomatic in the way that all frameworks and libraries pass data from outer components to inner components via attributes.

-- 
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-322822223

Received on Wednesday, 16 August 2017 16:13:09 UTC