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

Graphical custom-element example which yearns to be faster, it works out every day towards this goal:


```jsx
// Scene rendered by React for example

var xRotation = ...;
var yRotation = ...;
var zRotation = ...;

return <three-dee-scene>
  <mesh-geometry rotation={`${xRotation} ${yRotation} ${zRotation}`}>
  </mesh-geometry>
</scene>
```

As you can see, this is dumb. We have to pass string values that will be converted back to numbers. This is like the element choosing to run a marathon with weights on its ankles and wrist thinking it will be faster. The element was supposed to take the weights off before the marathon, but HTML spec told it not to. Three.js wins, it did not have this restriction, but also Three.js does not have the declarative advantage.

Now look at [A-Frame](http://aframe.io) @annevk. It is plausible that people will want to stick such elements inside React/Angular/Vue/etc frameworks and libraries. Surely we don't want their apps to have to have absurdly pointless number-to-string-to-number conversions just because they are passing attributes to inner elements.

We would love to help make the web faster (especially for modern graphics, which is my use case and why I brought this whole issue up in the first place).

I'm not just making generic simple 2D applications. I am trying to make 60fps 3D animated applications. And the declarative paradigm of HTML bring much developer productivity. I'd just like to fine-tune performance, and avoiding number-to-string-to-number conversions is one step towards that.

## And it has to be done through `setAttribute` because `setAttribute` is the one standard thing (not just a convention @treshugart ) that almost **every** library or framework relies on for passing data (not something else that isn't standard like instance properties).

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

Received on Wednesday, 16 August 2017 16:45:36 UTC