Polyfiller icon indicating copy to clipboard operation
Polyfiller copied to clipboard

Intl polyfill overrides Intl.Collator

Open Pickachu opened this issue 6 years ago • 0 comments

I'm using Intl.Collator to compare some strings and also the Intl.ListFormat polyfill on the same app. My app fails while trying to create a instance of the Intl.Collator class.

Importing with the url: https://polyfill.app/api/polyfill?features=intl.list-format

Pen to reproduce: https://jsbin.com/peyulegiba/edit?html,js,output (Opening in a browser that loads and applies the polyfill, yields undefined instead of function Collator())

When debugging on mobile Safari 12, i found the overriding line: https://github.com/wessberg/Polyfiller/blob/3bffbad8a9a912012f59029514bf8199f43ef266/polyfill-lib/intl/intl.js#L5818

Probably just coping over the Intl.Collator to the polyfilled Intl will solve the issue.

window.Intl = Object.assign(window.Intl, Intl$1);

Thanks for the awesome service, looking forward to use the custom-elements polyfill next. =D

Pickachu avatar Dec 28 '19 14:12 Pickachu