Closed DanielRuf closed 6 years ago
@DanielRuf could you create a repro? In bel I've definitely created all sorts of custom attributes — I wonder what scenario is preventing you from using the example. Thanks!
Well, the y
attribute isn't output at all in the pure Node version on Node 8 with npm 5.
Will provide an example in about 2 hours because I'm sure this specific demo did just return a h1 element without the y attribute (on Windows 10).
const h = require('hyperscript')
const hyperx = require('hyperx')
const hx = hyperx(h)
var title = 'world'
var wow = [1,2,3]
var tree = hx`<div>
<h1 y="ab${1+2}cd">hello ${title}!</h1>
</div>`
console.log(tree.outerHTML)
outputs
<div>
<h1>hello world!</h1>
</div>
It seems that custom tags and attributes are not fully supported.
My dependencies:
"hyperscript": "^2.0.2",
"hyperx": "^2.3.1",
"virtual-dom": "^2.1.1"
yeah looks like hyperscript doesn't support custom attributes like that in the browser. it does on the server, which is why the test z_hyperscript
that runs that snippet does work.
bel does support custom attributes, maybe we could switch the example to use that. or patch hyperscript so it works both on the server and the browser.
@goto-bus-stop
This was the node (server) example on my Windows command line, not in the browser.
oh sorry. huh. could you check if npm test
in this repo fail too then on windows? that uses the same snippet.
All 53 tests pass.
Daniel MINGW64 ~/.../component-library3
$ cat index.js
const h = require('hyperscript')
const hyperx = require('hyperx')
const hx = hyperx(h)
var title = 'world'
var wow = [1,2,3]
var tree = hx`<div>
<h1 y="ab${1+2}cd">hello ${title}!</h1>
</div>`
console.log(tree.outerHTML)
Daniel MINGW64 ~/.../component-library3
$ node index.js
<div>
<h1>hello world!</h1>
</div>
$ npm --version
5.3.0
$ node --version
v8.4.0
https://github.com/choojs/hyperx#hyperscript-node-example does not support the custom
y
attribute and does not render the same output.