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

The better trim() polyfill. #4072

Merged
merged 4 commits into from May 4, 2022
Merged

The better trim() polyfill. #4072

merged 4 commits into from May 4, 2022

Conversation

catscarlet
Copy link
Contributor

According to the document of String.prototype.trim() on mdn, trim() not only deals with \s but also \s\uFEFF\xA0. This is the better polyfill of trim().

Notice on the newest page of String.prototype.trim(), the polyfill part is removed because it was so outdated. The last browser that needs polyfill was WebView Android 37, which was released 7 years ago. See mdn/content#7602

Also I know axios why keeps a polyfill version of trim()(See this) and also know about #3980 , but it can be done better.

Copy link
Contributor

@caugner caugner left a comment

Choose a reason for hiding this comment

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

LGTM, and verified that the polyfill is identical to the one mentioned by MDN

@jasonsaayman
Copy link
Member

Thanks this looks great

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

3 participants