Skip to content
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

Clear previous children when SVG node doesn't have innerHTML #11108

Merged

Conversation

OriR
Copy link
Contributor

@OriR OriR commented Oct 5, 2017

Fixes #10013

I also fixed the UT, but they only work in node 6+ (using Proxy).
I saw that node 4-5 are still supported as development environments, so if this upgrade is not possible right now I'll revert them.
Couldn't get the tests to work otherwise 😞

@reactjs-bot
Copy link

Deploy preview ready!

Built with commit 3fad3b5

https://deploy-preview-11108--reactjs.netlify.com

@gaearon
Copy link
Collaborator

gaearon commented Oct 5, 2017

Have you tested it in IE?

@OriR
Copy link
Contributor Author

OriR commented Oct 5, 2017

The only IE environment I have is IE11 Windows 10 on Parallels and it's now working there (that's the environment I originally encountered this issue)

@nhunzaker
Copy link
Contributor

@gaearon @OriR I can test against IE9 and IE10 in a bit.

@nhunzaker
Copy link
Contributor

@gaearon @OriR I have confirmed this works in IE9 and IE10! I made an SVG test fixture for it here:

http://react-svg-innerhtml.surge.sh/svg

We can decide if we want to merge this test fixture later. I can send out a PR for that later.

return prop === 'innerHTML' ? false : prop in target;
},
get: (target, prop) => {
if (prop === 'appendChild') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? If you append a child to another parent, it will be removed from the current parent.

Isn't just

        get: (target, prop) => {
          return target[prop];
        },

enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the comment here it says that JSDOM doesn't remove the node from the current parent when moving nodes using appendChild, though I didn't verify this myself.

I could check and see if that's still relevant, if not then I can remove the get handler altogether.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this, yes. The comments might be very outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You were right, this was no longer necessary 🎉
Removed the get handler altogether!

@gaearon gaearon merged commit 6ad6dcd into facebook:master Oct 10, 2017
@gaearon
Copy link
Collaborator

gaearon commented Oct 10, 2017

Thanks.

@OriR OriR deleted the clear-previous-html-when-node-has-no-inner-html branch October 10, 2017 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dangerouslySetInnerHTML in IE11 for svg elements
5 participants