Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | var fails = require('../internals/fails');
|
---|
2 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
---|
3 | var IS_PURE = require('../internals/is-pure');
|
---|
4 |
|
---|
5 | var ITERATOR = wellKnownSymbol('iterator');
|
---|
6 |
|
---|
7 | module.exports = !fails(function () {
|
---|
8 | var url = new URL('b?a=1&b=2&c=3', 'http://a');
|
---|
9 | var searchParams = url.searchParams;
|
---|
10 | var result = '';
|
---|
11 | url.pathname = 'c%20d';
|
---|
12 | searchParams.forEach(function (value, key) {
|
---|
13 | searchParams['delete']('b');
|
---|
14 | result += key + value;
|
---|
15 | });
|
---|
16 | return (IS_PURE && !url.toJSON)
|
---|
17 | || !searchParams.sort
|
---|
18 | || url.href !== 'http://a/c%20d?a=1&c=3'
|
---|
19 | || searchParams.get('c') !== '3'
|
---|
20 | || String(new URLSearchParams('?a=1')) !== 'a=1'
|
---|
21 | || !searchParams[ITERATOR]
|
---|
22 | // throws in Edge
|
---|
23 | || new URL('https://a@b').username !== 'a'
|
---|
24 | || new URLSearchParams(new URLSearchParams('a=b')).get('a') !== 'b'
|
---|
25 | // not punycoded in Edge
|
---|
26 | || new URL('http://тест').host !== 'xn--e1aybc'
|
---|
27 | // not escaped in Chrome 62-
|
---|
28 | || new URL('http://a#б').hash !== '#%D0%B1'
|
---|
29 | // fails in Chrome 66-
|
---|
30 | || result !== 'a1c3'
|
---|
31 | // throws in Safari
|
---|
32 | || new URL('http://x', undefined).host !== 'x';
|
---|
33 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.