package
Convert hyperscript attributes to properties
npm install hyperscript-attribute-to-propertyGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
4.2 kB
Includes dependencies.
Some html attributes have different JavaScript property names. The most annoying of these
is class v.s. className.
With this package, you can do this:
var vnode = h('div', { class: 'my-class' })Instead of this:
var vnode = h('div', { className: 'my-class' })Works with virtual-dom, react, hyperscript, or any DOM builder with a hyperscript-style API: h(tagName, attrs, children).
npm install hyperscript-attribute-to-propertyvar attrToProp = require('hyperscript-attribute-to-property')
var h = attrToProp(require('virtual-dom/h'))If you use the hyperx package, then this functionality is built-in and implemented via this package :)
MIT. Copyright (c) Feross Aboukhadijeh.