iterator: syntax error in IE
Closed this issue · 9 comments
- OS: Windows 10 Pro
- Browser: Internet Explorer 11 (and emulation back through 7 and 5)
Error encountered:
SCRIPT1028: Expected identifier, string or number
bitset.js (911,5)
which points to the following line:
[Symbol.iterator]: function () {
I wasn't familiar with this as valid JS syntax, but some Googling helped me discover it's called a "computed property name" and that IE doesn't support it. I'm aware that IE is largely obsolete with Microsoft's promotion of Edge, but it still exists and does function as a modern browser for the most part. Could you switch to alternate syntax for adding the iterator? Many thanks!
It turns out that's not the only problem: String.repeat
is also too new for IE.
Who still uses IE<11? But could you please test/use the min file? There a polyfill is embedded for symbols.
It's true, I don't know that there's any point to my testing in IE (==11, by the way), but I try to be thorough. :)
The .min is still failing on the lack of String.repeat
, so a polyfill for that would also be necessary to support IE.
Could you test it with the polyfill from here please: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
If that works, it should be the only necessary change.
Yes, that makes it work. Thanks!
Great! Question now is, is it a documentation issue or a thing the lib should ship.
Sorry for the delay. My personal preference is to include it in the lib. That way, users like me can just install the lib as-is without worrying about patching it or whether the patch should be carried forward if/when you update the lib in the future.
Polyfilling is not the worry of the library. I would put a note saying it needs it for older browsers.
No need to burden newer browsers with it.
Does anyone has a Flintstones Browser running to check what features need to be polyfilled? Math.clz32 is feature tested in the lib. The symbol iterator is fixed by Closure Compiler in the min file. Probably Array.prototype.every and String.protototype.repeat are the only remaining things. If they are, I could also circumvent them in the code.