-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
native-url.js
24 lines (22 loc) · 881 Bytes
/
native-url.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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';
});