-
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
Fixed bug with updating TextNode in IE8 (#7824) #7826
Conversation
Thank you for your pull request. As you may know, we require contributors to sign our Contributor License Agreement, and we don't seem to have you on file and listed as active anymore. In order for us to review and merge your code, please email cla@fb.com with your details so we can update your status. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
That's wrong, it will render the HTML as text rather than HTML. EDIT: Oh, now I see #7824. |
It's bothersome to reproduce this because you can't run jsfiddles on IE8 (IE8 emulation is not the same as IE8!), so I don't have the time right now. However, because TextNodes doesn't have So this behavior should definitely be investigated, but I'm quite sure that this PR isn't a correct fix. |
Well, I do have a real IE8 VM, I just hate firing it up because it doesn't even have a proper debugger. I managed to reproduce it properly now. I've hosted a unadulterated copy of the demo here. I had to run all the libs through webpack to get it to run in IE8. Here's what's included:
I'm not sure why this bug doesn't affect newer browsers -- is this handled further up the callstack for them? Maybe they don't even enter this |
I switched back to IE11 emulating IE8 so that I could get a callstack. It actually goes through here first: var setTextContent = function(node, text) {
if (text) {
var firstChild = node.firstChild;
if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) {
firstChild.nodeValue = text;
return;
}
}
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function(node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text)); // <-- gets called
};
}
} You'll note that it only falls back to So, new browsers should use |
@mnpenner Ah now that makes a lot more sense :) excellent digging. So PS. Also, you messed up the PR when you pulled/rebased. |
@syranide Yeah...sorry. Totally different workflow at my company. Don't know how this Git + Github stuff works 😝 I was trying to revert my code to facebook/react master so I could try again. Would we want to put that check in the fallback It seems like it should be in the original too, but it never gets hit AFAIK. |
@mnpenner Absolutely no worries, just wanted to give the heads up :)
Yeah, so the fallback |
As for the "original" |
@@ -28,7 +28,7 @@ var setInnerHTML = require('setInnerHTML'); | |||
var setTextContent = function(node, text) { | |||
if (text) { | |||
var firstChild = node.firstChild; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, but this wasn't really necessary :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhpStorm did that 😢 I noticed after I pushed.
Looks good to me 👍 cc @jimfb |
Oh sorry, the PR is still messed up. |
Uhhh...hate to ask, but do you know the Git commands to set my repo back to a "clean" state so I can try again? |
Fixes #7824