question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fragments in IE11 rendered as strange elements

See original GitHub issue

React / ReactDOM: 16.4.2

I’m having trouble reproducing this, but I’m raising it in the hope that someone can give me some clues as to the cause. I have a large application which is using Fragment in a few places, like so:

<React.Fragment>
    <div>Child 1-1</div>
    <div>Child 1-2</div>
</React.Fragment>
<React.Fragment>
    <div>Child 2-1</div>
    <div>Child 2-2</div>
</React.Fragment>

In everything but Internet Explorer, this renders as you’d expect:

<div>Child 1-1</div>
<div>Child 1-2</div>
<div>Child 2-1</div>
<div>Child 2-2</div>

However, for some reason in Internet Explorer 11, these are being rendered as some weird tags:

<jscomp_symbol_react.fragment16>
    <div>Child 1-1</div>
    <div>Child 1-2</div>
</jscomp_symbol_react.fragment16>
<jscomp_symbol_react.fragment16>
    <div>Child 2-1</div>
    <div>Child 2-2</div>
</jscomp_symbol_react.fragment16>

I’ve tried pausing the code at the transpiled _react.createElement(_react.Fragment) line, and the _react.Fragment export is a string with the same name as the tag (jscomp_symbol_react.fragment16). I think this is just the correct way in which the symbol polyfill works and that React should recognize it as something other than an HTML tag.

What’s even weirder is that this only happens sometimes. If two components in my app are using fragments, the first one to render may have the above issue, the second may not. If an affected component re-renders, the rendered DOM will be corrected. I haven’t found a solid pattern to this yet.

I have a fairly typical webpack + babel setup, and using the babel-polyfill for symbol support. I’m really not sure what parts of my setup are relevant to this so please let me know if you need any extra info. Again, I’m trying to create a reproduction outside of my application but if anyone can offer me some clues in the meantime I’d be incredibly grateful.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
Shenlokcommented, Aug 16, 2018

Seems to be an issue with the Symbol polyfill implementation from the Closure compiler, see Sam Saccone’s tweet

3reactions
Shenlokcommented, Aug 16, 2018

As @sanniassin pointed out, the Google Maps polyfill is causing Symbol() to return strings. There are various places in the React code that check the typeof an element’s type, and often checking for string types before checking for the REACT_FRAGMENT_TYPE ‘Symbol’ e.g here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is IE 11 not rendering :after element, showing css as ...
The icons are to be rendered as the content of the :after pseudo class, which according to my research should work fine on...
Read more >
The React Handbook – Learn React for Beginners
React is a library, so saying install might sound a bit weird. ... This is best when your React app will interact with...
Read more >
Taking the new Chromium WebView2 Control for a Spin in .NET
The render behavior is the same as you'd see in an actual browser - a fragment basically gets an emtpy <html><body> wrapper around...
Read more >
Lit for React Developers - Google Codelabs
Lit is a simple library for building fast, lightweight web components that work in any framework, or with no framework at all. With...
Read more >
Fix web compatibility issues using document modes and the ...
The Internet Explorer 11 Enterprise Mode site list lets you specify document modes for specific websites, helping you fix compatibility ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found