inexorabletash / polyfill

JavaScript Polyfills, Shims and More
Other
1.36k stars 354 forks source link

Add URLSearchParams.prototype.sort() #135

Open hzr opened 7 years ago

hzr commented 7 years ago

https://url.spec.whatwg.org/#dom-urlsearchparams-sort

inexorabletash commented 7 years ago

The problem with the patch as-is is that several browser implementations shipped a version without sort(). That means very old browsers would use the full polyfill with sort(), and very new browsers don't need the polyfill. But in between there are browsers that would have URLSearchParams but no sort() (such as the current versions of Chrome)

To add this safely it'll be necessary to include a polyfill for a native URLSearchParams without sort().

hzr commented 7 years ago

Yes, good point. I can look into this when I have the time.

inexorabletash commented 7 years ago

Thanks! I greatly appreciate the PR submission and especially the inclusion of tests.

inexorabletash commented 7 years ago

Also, obviously, CI running on PRs would catch this, but I haven't been spending any time on this project lately. :(