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 } )

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.2.224latest

Version History

VersionDownloads (Last 7 Days)Published
0.2.224
0.2.10
0.2.00
0.1.00

Package Sidebar

Install

npm i dom-treeadapter

Weekly Downloads

24

Version

0.2.2

License

MIT

Unpacked Size

15.1 kB

Total Files

11

Last publish

Collaborators

  • nrkn