You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use https://github.com/leizongmin/js-xss to do some sanitation of the my html before parsing it and making React elements. I except the sanitized html to be parsed correctly into elements.
Run through the html parser I only get at string back looking exactly like the original html—no React elements. Should the parser correctly parse sanitized html?
Parsing the original html gets me the expected React elements.
Yes, that behavior is expected because xss will escape all your angle brackets. E.g., < to <.
Then when you input the string to html-react-parser, it will decode your string with HTML entities via html-dom-parser and spit out the string. It is considered escaped here since it is a string, not a JSX element.
Expected Behavior
I use https://github.com/leizongmin/js-xss to do some sanitation of the my html before parsing it and making React elements. I except the sanitized html to be parsed correctly into elements.
Actual Behavior
The html I want to sanitize and parse is this:
Run through the xxs filter I get this:
Run through the html parser I only get at string back looking exactly like the original html—no React elements. Should the parser correctly parse sanitized html?
Parsing the original html gets me the expected React elements.
Steps to Reproduce
Install https://github.com/leizongmin/js-xss and filter some html before parsing it.
Reproducible Demo
Environment
The text was updated successfully, but these errors were encountered: