Closed mhassan1 closed 1 month ago
I've looked around at a few other URL
polyfills:
If we switch to a different polyfill, then my preference would be to use https://www.npmjs.com/package/whatwg-url
The contributors there are also browser implementers, I trust them more to get this right.
Can we handle transpiling?
npmjs.com/package/core-js-url-browser - lots of tests fail
Could you write specific issues with it?
@zloirock Here's an example of a failing test:
[...new URLSearchParams('?%C2').keys()][0]
// core-js -> "%C2"
// native -> "�"
Is that with core-js
itself or with the npmjs.com/package/core-js-url-browser
npm package? (that package seems archived/deprecated?)
@mhassan1 yes, I know that core-js
has some specific issues with URL
, mainly encoding specific, like https://github.com/zloirock/core-js/issues/1223, and the feature detection relaxed to forgive some engines bugs. I mean the list of failing tests that could help to fix it.
@romainmenke That's with core-js
; for example, in Node.js:
delete global.URLSearchParams;
var URLSearchParams = require('core-js/web/url-search-params');
[...new URLSearchParams('?%C2').keys()][0];
// -> "%C2"
@zloirock Here's the list of failing tests:
parses and sorts: %FE%FF
parses and sorts: %FF%FE
parses and sorts: %C2
parses and sorts: %C2x
parses and sorts: _charset_=windows-1252&test=%C2x
The existing
URL
polyfill does notthrow
for invalid input when it should; for example, all of these shouldthrow
:This issue was raised previously (https://github.com/JakeChampion/polyfill-library/issues/462), but it was never resolved, and there was a PR (https://github.com/JakeChampion/polyfill-library/pull/627) that was closed without comment.
There seem to be a bunch of existing
URL
polyfills out there, so maybe we should switch to a different one.