-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Empty element is not handled correctly by dangerouslySetInnerHTML #854
Comments
When using dangerouslySetInnerHTML, you are using the HTML5 parser which is not an XML parser. It has a lot of weird rules in order to parse any HTML you throw at it in backwards compatible ways. JSX is a proper XML parser though and should handle your code properly. |
should convert to
instead of
I have many custom tag which is not component but only text style, |
When you use dangerouslySetInnerHTML, React simply passes the HTML to the browser untouched and you don't get any benefit from using React. Why do you need to use dangerouslySetInnerHTML here? |
because I am rendering XML/TEI document , most tag only need styling or simply hidden.
is TEI pagebreak element which will be output directly to browser, and with a style it will be render nicely.
|
@yapcheahshen Yes, run this in your console |
@plievone thanks, I use JSX when ever possible, I sure can use XSLT to convert XML document to HTML, but it is cleaner to keep XML as-it-is in DOM tree.
and
it should be
to conform XML standard. |
React version 0.8.0
become
in DOM.
"normal text" should not be red in the following example.
The text was updated successfully, but these errors were encountered: