Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 665 Bytes

readme.md

File metadata and controls

33 lines (21 loc) · 665 Bytes

h2dom

Create DOM nodes using h functions

NOTICE This is not a patch function, it simply creates DOM nodes.

Example

var node = h('div', { class: 'foo' }, [
  h('span', null, 'foo'),
  ' bar'
])

document.body.appendChild(node)

Install

npm i h2dom

Usage

This function follows the h2spec guidelines.

h(tag, data?, children?)

  • tag: the element name passed to document.createElement(name)
  • data (optional): an object containing the attributes to set on the element
  • children (optional): an array of DOM nodes or primitive values to be listed under element.childNodes