Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(polyfill): Remove IE11 polyfills #1515

Merged
merged 4 commits into from
May 7, 2024
Merged

Conversation

JChan106
Copy link
Contributor

@JChan106 JChan106 commented May 6, 2024

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

@JChan106 JChan106 requested a review from a team as a code owner May 6, 2024 18:17
Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove the entire polyfill.js file?

@JChan106
Copy link
Contributor Author

JChan106 commented May 6, 2024

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
Copy link
Contributor Author

JChan106 commented May 6, 2024

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
Copy link
Contributor Author

JChan106 commented May 6, 2024

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.

@JChan106 JChan106 requested a review from jstoffan May 6, 2024 21:08
@jstoffan
Copy link
Collaborator

jstoffan commented May 6, 2024

I agree, we can likely safely remove the polyfill.

@@ -50,6 +50,10 @@ describe('lib/Preview', () => {
preview.logger = new Logger();
stubs = {};
stubs.api = new Api();
window.PerformanceObserver = jest.fn(() => ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mock needed, similar to PreviewPerf-test.js

Copy link
Collaborator

@jstoffan jstoffan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please check with the team on if they want to release this as a major version.

@bfoxx1906 bfoxx1906 self-requested a review May 7, 2024 14:23
Copy link
Contributor

@bfoxx1906 bfoxx1906 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Don't see any problems with this. Let's just make sure all the tests pass. There could be some tests that rely on the polyfills.

@mergify mergify bot merged commit 978aadd into box:master May 7, 2024
5 checks passed
@JChan106 JChan106 deleted the remove-polyfill branch May 7, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants