Minified version broken in IE8
line 66 of setInnerHTML node.innerHTML = '\uFEFF' + html; is minified as e.innerHTML = "" + t; in react.min.js and react-with-addons.min.js. An exception is thrown on on line 71 because textNode.data is undefined.
Here's a repro that's modified from the basic example
<script src="../../build/react.min.js"></script>
<script>
var Container = React.createClass({
render: function(){
return React.DOM.div(null, this.props.children);
}
});
var ExampleApplication = React.createClass({
render: function() {
var elapsed = Math.round(this.props.elapsed / 100);
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
var message =
'React has been successfully running for ' + seconds + ' seconds.';
return React.DOM.p(null, message);
}
});
React.renderComponent(
Container(null,
ExampleApplication({elapsed: new Date().getTime()}),
document.getElementById('container')
));
</script>
What encoding are you serving your HTML with? My guess is if you add <meta charset="utf-8"> to your <head> then this will work correctly, though maybe we should use only ASCII chars in our minified builds.
Never mind, I see that the character is actually missing. Maybe a bug in uglifyjs?
@spicyj As it's encoded the charset is irrelevant unless uglifyjs decodes it, being zero-width/invisible I imagine it would look like nothing is there... but it really seems like nothing is there. Very weird.
https://github.com/mishoo/UglifyJS2/blob/master/lib/parse.js#L209
Is apparently the culprit, but it doesn't seem like it should be. Perhaps uglifyjs decodes strings first and then strips for some reason...
mishoo/uglifyjs2#556
Hmm, this is interesting, this problem only surfaces if you double-uglify the source, perhaps something is wrong in our build-process?
PR #2249
@cascadian I should add; if this is a priority for you simply replace .innerHTML="" with .innerHTML="!" (you can replace "\uFEFF" with "!" in the source too) and it should work.
this problem only surfaces if you double-uglify the source, perhaps something is wrong in our build-process
Yes, we double uglify to remove dead requires from the tree (see #1933).
Is this still an issue? I'm seeing it with react-with-addons.min.js v 0.12.2 in IE8.
Ping, this is resolved in uglifyjs/master now at least. React should go the way of #2340 if you ask me though.
This issue, although easily fixed by @syranide's DIY patch, still exists in http://fb.me/react-0.13.1.min.js and any other FB-packaged react.min.js. :| Sorry to be a nag. In the end this is all IE8's fault anyway.
@markplindsay I haven't verified, but this was fixed upstream in UglifyJS some time ago so it should have solved itself... @zpao is it possible you're running the build process with an older UglifyJS?
@syranide, thanks for your followup. I am looking at a react-0.13.1.min.js I wgot from http://fb.me/react-0.13.1.min.js. Changing e.innerHTML="" to e.innerHTML="!" by adding the ! at Line 15, Column 17852 still fixes the issue.
@zpao Ah, apparently we've locked the uglifyjs dependency to 2.4.0 whereas the fix is in 2.4.17 (or perhaps the one after it, not sure what the tag means in https://github.com/mishoo/UglifyJS2/commit/24bc09b79bf9ca3a09eef4f536e7637568f7097a). There's no reason not to update the dependency right?
We just got bit by this issue. Please update uglify!
AFAIK no reason not to upgrade. @syranide want to send a PR to the 0.13-stable branch? (I forget how to update shrinkwrap files properly though…)
Send to master and I'll pull it in with other things
cheers, Paul
On Apr 10, 2015, at 12:26 PM, Ben Alpert <[email protected]mailto:[email protected]> wrote:
AFAIK no reason not to upgrade. @syranidehttps://github.com/syranide want to send a PR to the 0.13-stable branch? (I forget how to update shrinkwrap files properly though…)
— Reply to this email directly or view it on GitHubhttps://github.com/facebook/react/issues/2247#issuecomment-91658188.
Just confirmed that this is correct in the minified build now. We'll ship 0.13.2 this week with the fix.
will 0.12.x get rebuild too?