box / box-content-preview

JavaScript library for rendering files stored on Box
https://developer.box.com/docs/box-content-preview
Other
106 stars 113 forks source link

fix(polyfill): Remove IE11 polyfills #1515

Closed JChan106 closed 5 months ago

JChan106 commented 5 months ago

IE11 is no longer supported. This removes some polyfills needed for IE11 as those polyfills can cause other issues as we move forward.

JChan106 commented 5 months ago

Can we remove the entire polyfill.js file?

Looking at the PR's for the other shims, they don't seem to specify that they were only for IE11. I see that Number.isNaN, includes, and other functions arent unsupported by older Chrome, Firefox, Safari browsers. Need to check what specific browser versions we support.

JChan106 commented 5 months ago

Can we remove the entire polyfill.js file?

Looking at the PR's for the other shims, they don't seem to specify that they were only for IE11. I see that Number.isNaN, includes, and other functions arent unsupported by older Chrome, Firefox, Safari browsers. Need to check what specific browser versions we support.

Reflect.construct isn't supported on the older versions of Chrome, Firefox, and Safari as well https://caniuse.com/mdn-javascript_builtins_reflect_construct. Given that, if we move forward with the removal, we should be okay with removing the other polyfills as well.

JChan106 commented 5 months ago

Investigated the polyfilled functions using caniuse.com. The browsers (Chrome, Edge, Safari, Firefox) that don't support the functions all have less than a .1% global usage. Some examples:

Reflect.construct: Chrome 34 - .01% usage Chrome 38 - .02% usage Chrome 47 - .01% usage Chrome 48 - .02% usage Safari 9.1 - .01% usage

Array.find: Chrome 34 - .01% usage Chrome 38 - .02% usage

Array.findIndex: Chrome 34 - .01% usage Chrome 38 - .02% usage

Array.includes: Chrome 34 - .01% usage Chrome 38 - .02% usage

String.endsWith: Chrome 34 - .01% usage Chrome 38 - .02% usage Safari 8 - 0.1% usage

Number.isNaN: Safari 8 - 0.1% usage

PerformanceObserver: Edge 18 - .03% usage

These are all very old versions of browsers, I think we are safe to remove the polyfill file. We'll just have to make sure we thoroughly QA test.

jstoffan commented 5 months ago

I agree, we can likely safely remove the polyfill.