Re: [w3c/webcomponents] idea: easy way to specify attributes (and optionally enable getters/setters). (#517)

With this change, it'd make the use of things like JSX with native DOM API possible. Imagine JSX compiling to a native DOM API instead of a bunch of the [React-like implementations that currently exist](https://forums.meteor.com/t/react-facebook-patent-a-problem/21152/34?u=joe). Many of those libraries listed there give us the ability to pas around plain JavaScript data without serializing until the very end when the libraries have to generate real DOM. It would be absolutely great to remove that serialization step.


Imagine if the `document.createElement` function (and the `shadowRoot.createElement` from #488) were given a new second parameter that would let us write something like this:

```js
let element = document.createElement('div', {
  attributes: {
    id: "someDiv",
    array: [1,2,3]
  },
  children: [
    document.createElement('span', {children: [
      document.createTextNode('hello')
    ]})
  ]
})
```

This would open the doors to JSX-like libraries used with native DOM API, so the above could be written as:

```js
let element = (
  <div id="someDiv" array={[1,2,3]}>
    <span>hello</span>
  </div>
)
```

Notice how the array literal would get passed without performance loss from serialization.

---
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/517#issuecomment-224766903

Received on Thursday, 9 June 2016 00:01:59 UTC