Nougat Predominant Middleware
Wondering what’s next for npm?Check out our public roadmap! »

dom-parser
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/dom-parser package

0.1.6 • Public • Published

dom-parser

Fast dom parser based on regexps

installation

npm install dom-parser

usage

var DomParser = require('dom-parser');
var parser = new DomParser();

fs.readFile('htmlToParse.html', 'utf8', function(err, html){
  if (!err){
    var dom = parser.parseFromString(html);

    console.log(dom.getElementById('myElement').innerHTML);
  }
})

API

Dom

Implemented methods:

  • getElementById
  • getElementsByClassName
  • getElementsByTagName
  • getElementsByName
Node

Implemented properties

  • nodeType
  • nodeName
  • childNodes
  • firstChild
  • lastChild
  • parentNode
  • attributes
  • innerHTML
  • outerHTML
  • textContent

Implemented methods

  • getAttribute
  • getElementById
  • getElementsByClassName
  • getElementsByTagName
  • getElementsByName

Usage - https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement

contributing

issues and pull requests are welcome!

Install

npm i dom-parser

DownloadsWeekly Downloads

17,719

Version

0.1.6

License

ISC

Unpacked Size

30.7 kB

Total Files

16

Last publish

Collaborators

  • avatar