fast-html is a sax-style HTML parser focused on performance. It only copes with sane HTML - see the Things that break section.
npm install --save fast-html
Test-documentation generated with mocha's "doc" reporter.
var fastHtml = require('fast-html')({ parseAttributes: true });
// Receive start tags
fastHtml.on('start', function(tagName, attributes){
});
// Receive text nodes
fastHtml.on('data', function(text){
});
// Receive end tags
fastHtml.on('end', function(tagName)) {
});
// Release the hounds
fastHtml.parse('<ul id="list"><li>Hello World</li></ul>')
FastHTML is designed for maximum performance, therefore it will not
- Try to fix broken markup
- Try to fix slightly broken markup
- Try to do automagic closing stuff
- Be graceful about unescaped HTML strings in inline
script
,style
and HTML attributes
</script>
strings in inlinescript
- Use<![CDATA[...]]>
.- HTML strings in attributes - Escape them.