Extending some native object doesn't work in IE11
See original GitHub issueBug Report
Current Behavior
IE11 throws a runtime error when transpiling class extension for native objects like: Foo class extends DocumentFragment {}
The problem is in this helper:
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
Here is the runtime error:
Function.prototype.toString: 'this' is not a Function object
The issue appears to be because superClass
needs to be a function but typeof HTMLElement
is object (in IE11) Note that typeof HTMLElement
is function in other browsers.
Input Code
- REPL or Repo link if applicable:
class X extends DocumentFragment {}
Expected behavior/code It should work? 😃
Possible Solution I haven’t though too much about it, but maybe another check for isNative will be sufficient
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Error in IE 11 browser - EXCEPTION: Object doesn't support ...
11 it shows error as error comes in IE 11 DEVELOPER TOOLS. The error shows up in developer tools of the IE 11....
Read more >Browser Compatibility of Object.entries on Internet Explorer 11
Object.entries is Not Supported on Internet Explorer 11. Checkout overall cross browser compatibility of Object.entries on Internet Explorer ...
Read more >Fix web compatibility issues using document modes and the ...
Go to a site having compatibility problems, press F12 to open the F12 Developer Tools, and go to the Emulation tool. Emulation tool...
Read more >Merging objects with vanilla JavaScript | Go Make Things
Vanilla JavaScript doesn't offer any native method to merge ... The Basic Approach To make this work, we want to create an empty...
Read more >Using IndexedDB - Web APIs - MDN Web Docs
The open request doesn't open the database or start the transaction ... You can also create indices on any object store, provided the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
To save you sometime, add the following after your custom element polyfills:
In my case, it would look like this:
FWIW, I just ran into this issue and turns out I’d simply forgotten to include the Custom Elements polyfill (document-register-element in my case) required for IE 11. Not sure whether that invalidates this issue, but perhaps mentioning it here saves others some trouble.