- From: Federico Brigante <notifications@github.com>
- Date: Tue, 19 Sep 2017 08:51:37 +0000 (UTC)
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 19 September 2017 08:52:02 UTC
A simple, consistent API would be good.
An API compatible with [JSX transformed code](https://babeljs.io/docs/plugins/transform-react-jsx/#optionspragma) would be grand:
1. Write JSX
```js
document.body.append(<div>Hello world!</div>);
```
2. Set `pragma: Element.create`
```js
/** @jsx Element.create */
```
3. Run babel. Done.
```js
document.body.append(Element.create(
"div",
null,
"Hello world!"
));
```
Live [demo on babel repl](https://babeljs.io/repl/#?babili=false&browsers=&build=&builtIns=false&code_lz=PQKhAIAECsGcA9wFEA2BTAtmgdgFwHQDGATmgIa5rgjABQAJgPaECuWe-ARo_QJ75kADoJz0AFAB56ASwBuAPgASaFCkbgA7o2Ip6AQgnAZCgJQBuIA&debug=false&circleciRepo=&evaluate=true&lineWrap=false&presets=es2015%2Creact%2Cstage-0&prettier=false&targets=&version=6.26.0)
To be clear I'm asking to make the [`h` package](https://www.npmjs.com/package/h) into a standard, not the JSX syntax.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/150#issuecomment-330473674
Received on Tuesday, 19 September 2017 08:52:02 UTC