# stricter-htmlparser2 [![NPM version](http://img.shields.io/npm/v/stricter-htmlparser2.svg?style=flat)](https://npmjs.org/package/stricter-htmlparser2) [![Downloads](https://img.shields.io/npm/dm/stricter-htmlparser2.svg?style=flat)](https://npmjs.org/package/stricter-htmlparser2) [![Build Status](http://img.shields.io/travis/yanghuabei/stricter-htmlparser2/master.svg?style=flat)](http://travis-ci.org/yanghuabei/htmlparser2) [![Coverage](http://img.shields.io/coveralls/yanghuabei/stricter-htmlparser2.svg?style=flat)](https://coveralls.io/r/yanghuabei/htmlparser2) A forgiving HTML/XML/RSS parser. The parser can handle streams and provides a callback interface. ## Installation npm install 'stricter-htmlparser2' A live demo of htmlparser2 is available [here](https://astexplorer.net/#/2AmVrGuGVJ). ## Differences to htmlparser2 1. Attribute value without quote wrapped is not allowed. ``` // output { attribs: { name: "", value: "" } } ``` 2. "\"" is allowed in attribute value. ``` // output { attribs: { name: "hello \\"world" } } ``` 3. Record attributes key in a object that value is wrapped by single quote. The object is passed to `onopentag` method of parser's domhandler through the third argument. ``` // The third argument passed to onopentag: { name: true, class: true } ``` // If used with x-domhandler which is exported by this module, the parse result is like this: ```javascript { type: "tag", name: "foo", attribs: { name: "{{flag ? \"true\" : \"false\"}}", title: "title", class: "hidden" }, singleQuoteAttribs: { name: true, class: true }, selfClose: false } ``` 4. Add `selfClose` flag to parsed node element. **Input:** ```html