25 lines
881 B
JavaScript
25 lines
881 B
JavaScript
|
var fails = require('../internals/fails');
|
|||
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|||
|
var IS_PURE = require('../internals/is-pure');
|
|||
|
|
|||
|
var ITERATOR = wellKnownSymbol('iterator');
|
|||
|
|
|||
|
module.exports = !fails(function () {
|
|||
|
var url = new URL('b?e=1', 'http://a');
|
|||
|
var searchParams = url.searchParams;
|
|||
|
url.pathname = 'c%20d';
|
|||
|
return (IS_PURE && !url.toJSON)
|
|||
|
|| !searchParams.sort
|
|||
|
|| url.href !== 'http://a/c%20d?e=1'
|
|||
|
|| searchParams.get('e') !== '1'
|
|||
|
|| String(new URLSearchParams('?a=1')) !== 'a=1'
|
|||
|
|| !searchParams[ITERATOR]
|
|||
|
// throws in Edge
|
|||
|
|| new URL('https://a@b').username !== 'a'
|
|||
|
|| new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
|
|||
|
// not punycoded in Edge
|
|||
|
|| new URL('http://тест').host !== 'xn--e1aybc'
|
|||
|
// not escaped in Chrome 62-
|
|||
|
|| new URL('http://a#б').hash !== '#%D0%B1';
|
|||
|
});
|