OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf8"> |
| 5 <link rel="help" href="https://url.spec.whatwg.org/#dom-urlsearchparams-has"> |
| 6 <script src="../../resources/testharness.js"></script> |
| 7 <script src="../../resources/testharnessreport.js"></script> |
| 8 <script src="resources/testharness-extras.js"></script> |
| 9 <script> |
| 10 test(function() { |
| 11 var params = new URLSearchParams('a=b&c=d'); |
| 12 assert_true(params.has('a')); |
| 13 assert_true(params.has('c')); |
| 14 assert_false(params.has('e')); |
| 15 params = new URLSearchParams('a=b&c=d&a=e'); |
| 16 assert_true(params.has('a')); |
| 17 params = new URLSearchParams('=b&c=d'); |
| 18 assert_true(params.has('')); |
| 19 params = new URLSearchParams('null=a'); |
| 20 assert_true(params.has(null)); |
| 21 }, 'has() basics'); |
| 22 |
| 23 test(function() { |
| 24 var params = new URLSearchParams('a=b&c=d&&'); |
| 25 params.append('first', 1); |
| 26 params.append('first', 2); |
| 27 assert_true(params.has('a'), 'Search params object has name "a"'); |
| 28 assert_true(params.has('c'), 'Search params object has name "c"'); |
| 29 assert_true(params.has('first'), 'Search params object has name "first"'); |
| 30 assert_false(params.has('d'), 'Search params object has no name "d"'); |
| 31 params.delete('first'); |
| 32 assert_false(params.has('first'), 'Search params object has no name "first"'
); |
| 33 }, 'has() following delete()'); |
| 34 </script> |
| 35 </head> |
| 36 </html> |
OLD | NEW |