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 iOS Safari by patching Intl.NumberFormat #394

Merged
merged 5 commits into from
Oct 20, 2018

Conversation

zetlen
Copy link
Contributor

@zetlen zetlen commented Oct 19, 2018

This PR is a:

[ ] New feature
[ ] Enhancement/Optimization
[ ] Refactor
[x] Bugfix
[ ] Test for existing code
[ ] Documentation

Summary

Safari doesn't have the Intl.NumberFormat.prototype.formatToParts method, which Price.js expects. The resulting error causes the whole application to crash and the screen goes blank.

Rather than including the 150kb IntlPolyfill core, this PR includes a small and well-tested implementation of .formatToParts extracted from that library.

iOS Safari before:

screen shot 2018-10-19 at 1 53 37 pm

iOS Safari after:

screen shot 2018-10-19 at 1 49 58 pm

@coveralls
Copy link

coveralls commented Oct 19, 2018

Coverage Status

Coverage increased (+0.2%) to 16.114% when pulling 83f222f on zetlen/fix-price-browser-compat into d59a264 on release/2.0.

@zetlen zetlen merged commit 420d47e into release/2.0 Oct 20, 2018
@supernova-at supernova-at deleted the zetlen/fix-price-browser-compat branch July 25, 2019 15:17
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.

2 participants