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] COMPLEX_SELECTOR_PREFIX.includes wasn't transpiled #3397

Merged
merged 1 commit into from
Mar 30, 2021
Merged

[fix] COMPLEX_SELECTOR_PREFIX.includes wasn't transpiled #3397

merged 1 commit into from
Mar 30, 2021

Conversation

gatsbimantico
Copy link

COMPLEX_SELECTOR_PREFIX.includes wasn't transpiled,
causing issues in Internet Explorer 11 due lack of compatibility.

The fix is just replacing it for indexOf, in the meantime, the solution is to roll back to v5.2.0

CAUSE

The transpilation done with babel is not transpiling deep enough, as other Array.prototype.includes are being correctly transpiled, this single one (maybe because of being in the middle of an if statement or something fancy like that) seems to not be transpiled.

EFFECT

IE 11 is not compatible with this property of the array object, producing an error.

TEST

Compile the project and search for ".includes" in the minified file.

FIX

Replacing ".includes" for ".indexOf" for compatibility

PREVENTION

Consider adding some bundle validation as part of the Pull Request validation, making sure your bundle transpiles correctly for the browsers supported before merging into master.

@gatsbimantico
Copy link
Author

@probablyup, I applied the changes again on top of legacy-v5, sorry about the other PR, I realised the version wasn't following master too late.
Thanks also about the update towards v6 not supporting IE, we still have to support it so I'll try to keep an eye on legacy-v5 👍

Copy link
Contributor

@quantizor quantizor left a comment

Choose a reason for hiding this comment

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

Thanks!

@quantizor quantizor merged commit 99e5731 into styled-components:legacy-v5 Mar 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants