<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong><br>
IE11 throws error at <code class="notranslate">_isNativeFunction</code><br>
=&gt; <code class="notranslate">Function.prototype.toString: 'this' is not a Function object</code></p>
<p dir="auto"><strong>Input Code</strong></p>
<ul dir="auto">
<li>REPL or Repo link if applicable:</li>
</ul>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class MyElement extends HTMLElement {}"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">MyElement</span> <span class="pl-k">extends</span> <span class="pl-v">HTMLElement</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior/code</strong><br>
The code should return <code class="notranslate">true</code> and never throw error.</p>
<p dir="auto"><strong>Babel Configuration (.babelrc, package.json, cli command)</strong></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="preset-env"><pre class="notranslate"><span class="pl-s1">preset</span><span class="pl-c1">-</span><span class="pl-s1">env</span></pre></div>
<p dir="auto"><strong>Environment</strong></p>
<ul dir="auto">
<li>Babel version(s): 7</li>
<li>Node/npm version: node 11</li>
<li>OS: all</li>
<li>Monorepo: no</li>
<li>How you are using Babel: rollup-plugin-babel</li>
</ul>
<p dir="auto"><strong>Possible Solution</strong><br>
This is <strong>NOT</strong> the solution:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="export default function _isNativeFunction(fn) {
+  return typeof fn === 'function' &amp;&amp; Function.toString.call(fn).indexOf(&quot;[native code]&quot;) !== -1;
-  return Function.toString.call(fn).indexOf(&quot;[native code]&quot;) !== -1;
}"><pre class="notranslate">export default function _isNativeFunction(fn) {
<span class="pl-mi1"><span class="pl-mi1">+</span>  return typeof fn === 'function' &amp;&amp; Function.toString.call(fn).indexOf("[native code]") !== -1;</span>
<span class="pl-md"><span class="pl-md">-</span>  return Function.toString.call(fn).indexOf("[native code]") !== -1;</span>
}</pre></div>
<p dir="auto"><strong>Additional context/Screenshots</strong><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1109982/55489948-2e342180-5633-11e9-9d63-65a89b813bd3.png"><img src="https://user-images.githubusercontent.com/1109982/55489948-2e342180-5633-11e9-9d63-65a89b813bd3.png" alt="Screenshot 2019-04-03 at 16 52 00" style="max-width: 100%;"></a></p>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>Current Behavior</strong></p>
<p dir="auto">IE11 throws a runtime error when transpiling class extension for native objects like: <code class="notranslate">Foo class extends DocumentFragment {}</code></p>
<p dir="auto">The problem is in this helper:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function _isNativeFunction(fn) {
  return Function.toString.call(fn).indexOf(&quot;[native code]&quot;) !== -1;
}"><pre class="notranslate"><code class="notranslate">function _isNativeFunction(fn) {
  return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
</code></pre></div>
<p dir="auto">Here is the runtime error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Function.prototype.toString: 'this' is not a Function object"><pre class="notranslate"><code class="notranslate">Function.prototype.toString: 'this' is not a Function object
</code></pre></div>
<p dir="auto">The issue appears to be because <code class="notranslate">superClass</code> needs to be a function but <code class="notranslate">typeof HTMLElement</code> is object (in IE11) Note that <code class="notranslate">typeof HTMLElement</code> is function in other browsers.</p>
<p dir="auto"><strong>Input Code</strong></p>
<ul dir="auto">
<li>REPL or Repo link if applicable:</li>
</ul>
<p dir="auto"><a href="https://babeljs.io/repl/build/9254/#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;spec=false&amp;loose=false&amp;code_lz=MYGwhgzhAEAa0FMAeAXBA7AJjAIge2AFcBbDFAMQCcwBzU9FaAbwCgBfFl4PdCPEBADoQeGgApYASgDcQA&amp;debug=true&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=false&amp;presets=env&amp;prettier=true&amp;targets=&amp;version=7.1.2%2Bpr.8878&amp;envVersion=7.1.0%2Bpr.8878" rel="nofollow">https://babeljs.io/repl/build/9254/#?babili=false&amp;browsers=&amp;build=&amp;builtIns=false&amp;spec=false&amp;loose=false&amp;code_lz=MYGwhgzhAEAa0FMAeAXBA7AJjAIge2AFcBbDFAMQCcwBzU9FaAbwCgBfFl4PdCPEBADoQeGgApYASgDcQA&amp;debug=true&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=false&amp;presets=env&amp;prettier=true&amp;targets=&amp;version=7.1.2%2Bpr.8878&amp;envVersion=7.1.0%2Bpr.8878</a></p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="class X extends DocumentFragment {}
"><pre class="notranslate"><span class="pl-k">class</span> <span class="pl-v">X</span> <span class="pl-k">extends</span> <span class="pl-v">DocumentFragment</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto"><strong>Expected behavior/code</strong><br>
It should work? :)</p>
<p dir="auto"><strong>Possible Solution</strong><br>
I haven't though too much about it, but maybe another check for isNative will be sufficient</p>