dom-x

0.0.3 • Public • Published

dom-x

a module for quickly create dom elements. this module uses ES6 syntax!

install

npm i dom-x

usage

const x = require('dom-x')
 
document.body.appendChild(x('button', {
  id: 'foo'
  'class': 'bar baz'
  , click(event) {
    console.log('clicked!')
  }
}, x('b', 'click')))

api

x(element, options, content)

  • element: the name of the element you want to create. String
  • options: attributes and event handlers for the element. optional. Object
    • supported events: click
  • content: the content of the element. optional. DOM Node or String

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    2
  • 0.0.2
    1
  • 0.0.1
    1

Package Sidebar

Install

npm i dom-x

Weekly Downloads

4

Version

0.0.3

License

MIT

Last publish

Collaborators

  • gerhardberger