dommo

0.2.0 • Public • Published

view on npm npm module downloads Build Status Dependency Status js-standard-style

dommo

An isomorphic, load-anywhere function to convert an HTML string to a DOM tree.

import dommo from './node_modules/dommo/index.mjs'
 
/* passing in HTML with a single root returns an element */
const el = dommo('<some-element>something</some-element>')
document.body.appendChild(el)
 
/* passing in HTML with multiple root elements returns a DocumentFragment */
const frag = dommo('<some-element>something</some-element><some-element>something</some-element>')
document.body.appendChild(frag)

Load anywhere

This library can be loaded anywhere, natively without transpilation.

Node.js:

const dommo = require('dommo')

Within Node.js with ECMAScript Module support enabled:

import dommo from 'dommo'

Within a modern browser ECMAScript Module:

import dommo from './node_modules/dommo/index.mjs'

Old browser (adds window.dommo):

<script nomodule src="./node_modules/dommo/dist/index.js"></script>

© 2018-19 Lloyd Brookes <75pound@gmail.com>.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    0
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i dommo

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

5.11 kB

Total Files

5

Last publish

Collaborators

  • 75lb