@mojule/dom-utils

DOM traversal/query/manipulation functions

Stats

StarsIssuesVersionUpdatedCreatedSize
@mojule/dom-utils
000.2.83 years ago4 years agoMinified + gzip package size for @mojule/dom-utils in KB

Readme

dom-utils

DOM traversal/query/manipulation functions

npm install @mojule/dom-utils

example

const utils = require( '@mojule/dom-utils' )

const { parse, stringify, wrap, walk } = utils
const html = '<div>Hello</div>'
const div = parse( document, html )

walk( div, current => {
  if( current.nodeName === '#text' ){
    const p = document.createElement( 'p' )

    wrap( current, p )
  }
})

// '<div><p>Hello</p></div>'
console.log( stringify( div ) )

License

MIT

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.