2024-06-12 08:25:24 -04:00
|
|
|
<script>
|
|
|
|
console.error("URLSearchParams.html");
|
2024-06-14 15:24:14 -04:00
|
|
|
|
2024-06-14 15:28:36 -04:00
|
|
|
var empty = new URLSearchParams('');
|
|
|
|
console.assert(empty.size === 0, 'empty');
|
|
|
|
|
2024-06-14 15:24:14 -04:00
|
|
|
var param = new URLSearchParams('?foo=1&bar=2&cc=3');
|
|
|
|
console.assert(param.size === 3, 'size is 3');
|
2024-06-12 08:25:24 -04:00
|
|
|
console.assert(param.has('foo'), 'foo');
|
2024-06-14 15:24:14 -04:00
|
|
|
console.assert(param.has('cc'), 'cc');
|
2024-06-12 08:25:24 -04:00
|
|
|
console.assert(param.has('bar', '2'), 'bar=2');
|
|
|
|
console.assert(param.get('bar') === '2', 'bar = 2');
|
2024-06-14 15:24:14 -04:00
|
|
|
console.assert(param.toString() === 'foo=1&bar=2&cc=3', 'without ?');
|
2024-06-12 08:25:24 -04:00
|
|
|
console.exit();
|
|
|
|
</script>
|