OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-search"> | 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-search"> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 test(function() { | 7 test(function() { |
8 var url = new URL('http://www.domain.com/'); | 8 var url = new URL('http://www.domain.com/'); |
9 assert_equals(url.search, ''); | 9 assert_equals(url.search, ''); |
10 | 10 |
11 url = new URL('http://www.domain.com/?'); | 11 url = new URL('http://www.domain.com/?'); |
12 assert_equals(url.search, ''); | 12 assert_equals(url.search, ''); |
13 | 13 |
14 url = new URL('http://www.domain.com/?a'); | 14 url = new URL('http://www.domain.com/?a'); |
15 assert_equals(url.search, '?a'); | 15 assert_equals(url.search, '?a'); |
16 | 16 |
17 url.search = ''; | 17 url.search = ''; |
18 assert_equals(url.search, ''); | 18 assert_equals(url.search, ''); |
| 19 assert_equals(url.toString(), 'http://www.domain.com/'); |
19 | 20 |
20 url.search = '?'; | 21 url.search = '?'; |
21 assert_equals(url.search, ''); | 22 assert_equals(url.search, ''); |
| 23 assert_equals(url.toString(), 'http://www.domain.com/'); |
22 | 24 |
23 url.search = 'a'; | 25 url.search = 'a'; |
24 assert_equals(url.search, '?a'); | 26 assert_equals(url.search, '?a'); |
25 | 27 |
26 url.search = '?a'; | 28 url.search = '?a'; |
27 assert_equals(url.search, '?a'); | 29 assert_equals(url.search, '?a'); |
28 | 30 |
29 url.search = 'a#b'; | 31 url.search = 'a#b'; |
30 assert_equals(url.search, '?a%23b'); | 32 assert_equals(url.search, '?a%23b'); |
31 | 33 |
(...skipping 13 matching lines...) Expand all Loading... |
45 var url = new URL('http://abc.de:8080/path/file?query#fragment'); | 47 var url = new URL('http://abc.de:8080/path/file?query#fragment'); |
46 url.href = 'invalid'; | 48 url.href = 'invalid'; |
47 assert_equals(url.search, ''); | 49 assert_equals(url.search, ''); |
48 | 50 |
49 url.search = 'changed'; | 51 url.search = 'changed'; |
50 assert_equals(url.search, ''); | 52 assert_equals(url.search, ''); |
51 assert_equals(url.href, 'invalid'); | 53 assert_equals(url.href, 'invalid'); |
52 }, 'search property invalid URL'); | 54 }, 'search property invalid URL'); |
53 | 55 |
54 </script> | 56 </script> |
OLD | NEW |