remarkablemark / html-react-parser

📝 HTML to React parser.

Home Page:https://b.remarkabl.org/html-react-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Whitespace text nodes cannot appear as a child of <table>

brainstorm1313 opened this issue · comments

I expect correct parse:
parse('<table>\n<tbody><tr><td>sdfq</td></tr></tbody></table>')

It works, but Chrome console has error:
Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of

. Make sure you don't have any extra whitespace between tags on each line of your source code.

https://jsfiddle.net/2f7tpmx5/1/

commented

This is similar to aknuds1/html-to-react#79

Long story short, this parser (like html-to-react) creates whitespace text nodes given the input HTML.

The HTML to DOM parser that we use is html-dom-parser.

Fortunately, this is a warning and not an error. However, it might be worth looking into stripping out the whitespace nodes for this library.

commented

Please review #162

commented

Published 0.13.0:

npm:

npm install html-react-parser@0.13.0

yarn:

yarn add html-react-parser@0.13.0