0.1.0 • Published 7 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 h2dom
Usage
h(tag, data?, children?)
A h()
function specified in h2spec
tag
is an element name passed todoucment.createElement(name)
data
is attributes to set on the elementchildren
is 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
7 years ago