0.1.0 • Published 9 years ago
h2dom v0.1.0
h2dom
Create DOM nodes from h()
An h2spec h() function made for creating DOM nodes:
var node = h('div', { class: 'foo bar' }, [
h('span', 'hello world'),
' foobar'
])
document.body.appendChild(node)Install
npm i h2domUsage
h(tag, data?, children?)
A h() function specified in h2spec
tagis an element name passed todoucment.createElement(name)datais attributes to set on the elementchildrenis primitive values (strings, numbers, etc.) or the DOM node
var node = h('p', { class: 'test' }, 'hello world')
// <p class='test'>hello world</p>
document.body.appendChild(node)0.1.0
9 years ago