-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
Unnecessary encoding of element text content #3879
Comments
I've just taken a look at the React code for the first time. It's very readable. I can provide a fix for this if you agree it needs fixing. |
There's a bunch of discussion about this in #3152. Let's continue there, might be a good time to revisit and make it actually happen. I'm not an expert about this so definitely value more expert opinions! |
As part of the effort to move discussion of intent to issues and close stale PRs, I closed #3152 which did not get merged, and reopened this issue. If this is something we want to fix, let’s discuss it here, and reach consensus first. |
This issue hasn't seen much activity or interest over the last 3 years so I'm closing it |
Given the following piece of code:
React replaces the angle brackets, quotation mark, apostrophe and ampersands with their HTML entities, ie < > " & etc. I don't believe it is necessary to replace the quotation mark or the apostrophe. They don't need escaping. They would only need escaping when used in an attribute, not when used as the text content of an element.
The reason I noticed this is because I'm trying to encode some JSON into a HTML element on the server side which can then be read back by the client side javascript. JSON contains a lot of double quotation marks and they're all being needlessly replaced by "'s
The text was updated successfully, but these errors were encountered: