dom-treeadapter

0.2.2 • Public • Published

dom-treeadapter

A parse5-compatible TreeAdapter for the DOM

See TreeAdapter at parse5 documentation

Install

npm install dom-treeadapter

Usage

Browser:

const parse5 = require( 'parse5' )
const Adapter = require( 'dom-treeadapter' )

const adapter = Adapter( window.document )

const domNodes = parse5.parseFragment( '<div></div>', { treeAdapter: adapter } )

jsdom:

const parse5 = require( 'parse5' )
const Adapter = require( 'dom-treeadapter' )
const jsdom = require( 'jsdom' )

const { JSDOM } = jsdom
const dom = new JSDOM( '<!doctype html>' )
const { document } = dom.window

const adapter = Adapter( document )

const domNodes = parse5.parseFragment( '<div></div>', { treeAdapter: adapter } )

Readme

Keywords

Package Sidebar

Install

npm i dom-treeadapter

Weekly Downloads

13

Version

0.2.2

License

MIT

Unpacked Size

15.1 kB

Total Files

11

Last publish

Collaborators

  • nrkn