Repository: remarkablemark/html-react-parser (ts)

Issue:
[BUG] tags inside of <title> are not parsed as text on Node.js
## Expected Behavior

Tags inside of `<title>` should be escaped as text on Node.js:

```js
const parse = require('html-react-parser');
parse('<title><em>text</em></title>');
```

Output:

```js
{
  '$$typeof': Symbol(react.element),
  type: 'title',
  key: null,
  ref: null,
  props: { children: '<em>text</em>' },
  _owner: null,
  _store: {}
}
```

## Actual Behavior

Tags inside of `<title>` are parsed as React elements on Node.js:

```js
const parse = require('html-react-parser');
parse('<title><em>text</em></title>');
```

Output:

```js
{
  '$$typeof': Symbol(react.element),
  type: 'title',
  key: null,
  ref: null,
  props: {
    children: {
      '$$typeof': Symbol(react.element),
      type: 'em',
      key: null,
      ref: null,
      props: { children: 'text' },
      _owner: null,
      _store: {}
    }
  },
  _owner: null,
  _store: {}
}
```

## Steps to Reproduce

See above.

## Reproducible Demo

Repl.it: https://repl.it/@remarkablemark/html-react-parser-202

## Environment

- Version: [1.1.0](https://github.com/remarkablemark/html-react-parser/releases/tag/v1.1.0)
- Platform: Node.js
- Browser: N/A


Pull request description:
fix: escape tags inside of <title> (upgrade html-dom-parser to 1.0.0)
## What is the motivation for this pull request?

fix: escape tags inside of `<title>`

Fixes #202

## What is the current behavior?

Tags inside of `<title>` are not escaped.

## What is the new behavior?

Tags inside of `<title>` are escaped by upgrading to [html-dom-parser@1.0.0](https://github.com/remarkablemark/html-dom-parser/releases/tag/v1.0.0).

```
 html-dom-parser  0.5.0  →  1.0.0
```

## Checklist:

- [x] Tests
- [x] Documentation


Patch:
diff --git a/README.md b/README.md
index c9fe49c..29276a0 100644
--- a/README.md
+++ b/README.md
@@ -314,23 +314,21 @@ parse('<br>', {
 
 ### htmlparser2
 
-The default [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options) are:
+Along with the default [htmlparser2 options](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-xmlmode), the parser also sets:
 
-```js
+```json
 {
-  decodeEntities: true,
-  lowerCaseAttributeNames: false
+  "lowerCaseAttributeNames": false
 }
 ```
 
 Since [v0.12.0](https://github.com/remarkablemark/html-react-parser/tree/v0.12.0), the htmlparser2 options can be overridden.
 
-The following example enables [`decodeEntities`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-decodeentities) and [`xmlMode`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-xmlmode):
+The following example enables [`xmlMode`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-xmlmode) but disables [`lowerCaseAttributeNames`](https://github.com/fb55/htmlparser2/wiki/Parser-options#option-lowercaseattributenames):
 
 ```js
 parse('<p /><p />', {
   htmlparser2: {
-    decodeEntities: true,
     xmlMode: true
   }
 });
diff --git a/index.js b/index.js
index c66fbbd..3929d5a 100644
--- a/index.js
+++ b/index.js
@@ -2,8 +2,7 @@ var domToReact = require('./lib/dom-to-react');
 var attributesToProps = require('./lib/attributes-to-props');
 var htmlToDOM = require('html-dom-parser');
 
-// decode HTML entities by default for `htmlparser2`
-var domParserOptions = { decodeEntities: true, lowerCaseAttributeNames: false };
+var domParserOptions = { lowerCaseAttributeNames: false };
 
 /**
  * Converts HTML string to React elements.
diff --git a/package.json b/package.json
index 7860828..21a3a3e 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
     "dom"
   ],
   "dependencies": {
-    "html-dom-parser": "0.5.0",
+    "html-dom-parser": "1.0.0",
     "react-property": "1.0.1",
     "style-to-js": "1.1.0"
   },


Test patch:
diff --git a/test/__snapshots__/index.test.js.snap b/test/__snapshots__/index.test.js.snap
index 658946d..772788c 100644
--- a/test/__snapshots__/index.test.js.snap
+++ b/test/__snapshots__/index.test.js.snap
@@ -1,5 +1,11 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
+exports[`HTMLReactParser escapes tags inside of <title> 1`] = `
+<title>
+  &lt;em&gt;text&lt;/em&gt;
+</title>
+`;
+
 exports[`HTMLReactParser parses SVG 1`] = `
 <svg
   height="400"
diff --git a/test/data/html.js b/test/data/html.js
index 40c2892..e065a88 100644
--- a/test/data/html.js
+++ b/test/data/html.js
@@ -13,6 +13,7 @@ module.exports = {
   void: '<link/><meta/><img/><br/><hr/><input/>',
   comment: '<!-- comment -->',
   doctype: '<!DOCTYPE html>',
+  title: '<title><em>text</em></title>',
   customElement:
     '<custom-element class="myClass" custom-attribute="value" style="-o-transition: all .5s; line-height: 1;"></custom-element>'
 };
diff --git a/test/index.test.js b/test/index.test.js
index 59f0ba5..4ceb844 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -75,6 +75,10 @@ describe('HTMLReactParser', () => {
     const reactElement = parse('<i>' + encodedEntities + '</i>');
     expect(reactElement.props.children).toBe(decodedEntities);
   });
+
+  it('escapes tags inside of <title>', () => {
+    expect(parse(html.title)).toMatchSnapshot();
+  });
 });
 
 describe('replace option', () => {