BitSet.js icon indicating copy to clipboard operation
BitSet.js copied to clipboard

iterator: syntax error in IE

Open microshnik opened this issue 4 years ago • 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!

microshnik avatar May 23 '20 00:05 microshnik

It turns out that's not the only problem: String.repeat is also too new for IE.

microshnik avatar May 23 '20 04:05 microshnik

Who still uses IE<11? But could you please test/use the min file? There a polyfill is embedded for symbols.

infusion avatar May 23 '20 10:05 infusion

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.

microshnik avatar May 23 '20 10:05 microshnik

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.

infusion avatar May 23 '20 10:05 infusion

Yes, that makes it work. Thanks!

microshnik avatar May 23 '20 11:05 microshnik

Great! Question now is, is it a documentation issue or a thing the lib should ship.

infusion avatar May 23 '20 14:05 infusion

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.

microshnik avatar May 29 '20 07:05 microshnik

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.

schtauffen avatar Nov 03 '20 13:11 schtauffen

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.

infusion avatar Nov 03 '20 14:11 infusion