-
Notifications
You must be signed in to change notification settings - Fork 48.4k
dangerouslySetInnerHTML in IE11 for svg elements #10013
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Would you like to create a failing unit test and maybe send a fix? Thanks! |
(You can probably force this codepath by doing some JSDOM monkeypatching) |
This seems like it would be easy to fix by clearing the container, as you suggested. Indeed we can't really unit test it because it only occurs in IE11, but a manual test will do. Want to send a PR? |
Ah sorry... missed that one =/ |
React |
We haven't updated to React |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using
dangerouslySetInnerHtml
of svg elements, the DOM nodes from the previous render aren't being removed.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
See this fiddle
What is the expected behavior?
The DOM should only contain the last rendered value for
dangerouslySetInnerHTML
.Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React - 15.5.4+
Browser - IE11
Did this work in previous versions of React? Not sure
After digging around I found #6982 . Which made me think this is happening because of this line in
setInnerHTML.js
where it looks like thisBecause there's a call to
node.appendChild(svgNode.firstChild);
it will never remove all of the previous nodes but only add the new ones.But that's just a guess...
The text was updated successfully, but these errors were encountered: