Fast dom parser based on regexps
Switch branches/tags
Nothing to show
Clone or download
Latest commit 6fab5dc Dec 1, 2015
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib - fixed markup with excess closing tag Nov 22, 2015
test - fixed markup with excess closing tag Nov 22, 2015
.gitignore init repo Oct 19, 2015
LICENSE first implementation Oct 26, 2015
README.md Spelling correction Nov 28, 2015
index.js first implementation Oct 26, 2015
package.json Corrected indent Dec 1, 2015

README.md

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!