Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] tags inside of <title> are not parsed as text on Node.js #202

Closed
remarkablemark opened this issue Dec 27, 2020 · 1 comment · Fixed by #203
Closed

[BUG] tags inside of <title> are not parsed as text on Node.js #202

remarkablemark opened this issue Dec 27, 2020 · 1 comment · Fixed by #203
Assignees
Labels
bug Something isn't working

Comments

@remarkablemark
Copy link
Owner

remarkablemark commented Dec 27, 2020

Expected Behavior

Tags inside of <title> should be escaped as text on Node.js:

const parse = require('html-react-parser');
parse('<title><em>text</em></title>');

Output:

{
  '$$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:

const parse = require('html-react-parser');
parse('<title><em>text</em></title>');

Output:

{
  '$$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
  • Platform: Node.js
  • Browser: N/A
@remarkablemark
Copy link
Owner Author

Published v1.1.1:

npm:

Yarn:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant