Skip to content

Minified version broken in IE8 #2247

Closed
Closed
@cascadian

Description

@cascadian

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>

Activity

sophiebits

sophiebits commented on Sep 26, 2014

@sophiebits
Collaborator

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.

sophiebits

sophiebits commented on Sep 26, 2014

@sophiebits
Collaborator

Never mind, I see that the character is actually missing. Maybe a bug in uglifyjs?

syranide

syranide commented on Sep 26, 2014

@syranide
Contributor

@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.

syranide

syranide commented on Sep 26, 2014

@syranide
Contributor

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...

syranide

syranide commented on Sep 26, 2014

@syranide
Contributor
syranide

syranide commented on Sep 26, 2014

@syranide
Contributor

Hmm, this is interesting, this problem only surfaces if you double-uglify the source, perhaps something is wrong in our build-process?

syranide

syranide commented on Sep 26, 2014

@syranide
Contributor
syranide

syranide commented on Sep 26, 2014

@syranide
Contributor

@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.

zpao

zpao commented on Sep 29, 2014

@zpao
Member

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).

dennis-johnson-dev

dennis-johnson-dev commented on Dec 18, 2014

@dennis-johnson-dev
Contributor

Is this still an issue? I'm seeing it with react-with-addons.min.js v 0.12.2 in IE8.

17 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @sophiebits@zpao@ledowong@mockdeep@dennis-johnson-dev

      Issue actions

        Minified version broken in IE8 · Issue #2247 · facebook/react