airbnb / polyglot.js

Give your JavaScript the ability to speak many languages.
http://airbnb.github.io/polyglot.js
BSD 2-Clause "Simplified" License
3.71k stars 208 forks source link

IE compatibility #144

Closed renekliment closed 4 years ago

renekliment commented 4 years ago

Hi!

We've been using your amazing library and accidentally discovered, that unfortunately it is not compatible with Internet Explorer.

The reason is the use of for-each in .extend which calls isCallable.

However, isCallable returns false for the forEach callback for some reason in IE, which causes forEach to throw.

Can't provide a quick example now as both https://codesandbox.io/ and https://stackblitz.com/ do not load under IE properly. Let me know if you need me to run an instance somewhere.

Could you please have a look at this?

renekliment commented 4 years ago

Screenshot_2020-04-24_18-55-20

ljharb commented 4 years ago

isCallable shouldn't return false for any callback; that seems like a bug in the is-callable library - if you have a repro of that, please file it there.

This library has been working on IE 9, 10, and 11 for many many years, with is-callable, so I'm pretty confident the problem is something else in your setup.

ljharb commented 4 years ago

I do see, in your screenshot, that iterator is definitely a function. Can you debug-step into isCallable and determine on which line it's returning false?

renekliment commented 4 years ago

You're right, it seems like I have a messed up Object.prototype.toString polyfill somewhere causing the issue. Sorry for the inconvenience!