xom

0.4.0 • Public • Published

xom

TravisCI Coverage Dependencies Dev Dependencies npm version MIT License

Build DOM trees by misusing Proxy!

Features

  • Dynamic wrapper for document.createElement and document.createElementNS.
  • Use HTML or JavaScript attribute names.
  • Automatically wrap other arguments in document.createTextNode.

Install

npm install --save xom

Usage

Basic package usage:

import { dom } from 'xom'
const { div, span, b, i } = dom
 
document.appendChild(
  div({className: 'banana'},
    span('ba', b('na'), i('na'))
  )
)

Customize Xom:

import { Xom } from 'xom'
 
class MyXom extends Xom {}
const x = MyXom.proxy()
 
document.appendChild(
  x.div({className: 'banana'},
    x.span('ba', x.b('na'), x.i('na'))
  )
)

Readme

Keywords

none

Package Sidebar

Install

npm i xom

Weekly Downloads

1

Version

0.4.0

License

MIT

Last publish

Collaborators

  • kroogs