Fast dom parser based on regexps
npm install dom-parser
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);
}
})
Implemented methods:
- getElementById
- getElementsByClassName
- getElementsByTagName
- getElementsByName
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
issues and pull requests are welcome!