inexorabletash / polyfill

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

PhantomJS: URL encoding #84

Open Octane opened 8 years ago

Octane commented 8 years ago

The url.js returns different results in the browser and PhantomJS.

Test case

var url = new URL('https://site.com/%D1%87%D1%82%D0%BE-%D0%BD%D0%B8%D0%B1%D1%83%D0%B4%D1%8C/');

console.log(url.pathname);

Results

PhantomJS 1.9.8
/что-нибудь/

IE9, Opera 12.17
/%D1%87%D1%82%D0%BE-%D0%BD%D0%B8%D0%B1%D1%83%D0%B4%D1%8C/

Chrome 49, Firefox 45
/%D1%87%D1%82%D0%BE-%D0%BD%D0%B8%D0%B1%D1%83%D0%B4%D1%8C/
inexorabletash commented 8 years ago

The URL polyfill delegates to the native implementation of an anchor ("A") element if URL isn't present. So that would indicate that PhantomJS's implementation is buggy. Can you repro with just that, and file a bug against it if so?

(I don't consider it a priority for this library to paper over every single implementation bug, especially for non-browser use cases.)

inexorabletash commented 8 years ago

And getting it fixed in PhantomJS would also enable Travis-CI testing, if someone wants to learn me some of that...