OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-hash"> | 2 <link rel="help" href="http://url.spec.whatwg.org/#dom-url-hash"> |
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.hash, ''); | 9 assert_equals(url.hash, ''); |
10 | 10 |
11 url = new URL('http://www.domain.com/#'); | 11 url = new URL('http://www.domain.com/#'); |
12 assert_equals(url.hash, ''); | 12 assert_equals(url.hash, ''); |
13 | 13 |
14 url = new URL('http://www.domain.com/#a'); | 14 url = new URL('http://www.domain.com/#a'); |
15 assert_equals(url.hash, '#a'); | 15 assert_equals(url.hash, '#a'); |
16 | 16 |
17 url.hash = ''; | 17 url.hash = ''; |
18 assert_equals(url.hash, ''); | 18 assert_equals(url.hash, ''); |
| 19 assert_equals(url.toString(), 'http://www.domain.com/'); |
19 | 20 |
20 url.hash = '#'; | 21 url.hash = '#'; |
21 assert_equals(url.hash, ''); | 22 assert_equals(url.hash, ''); |
| 23 assert_equals(url.toString(), 'http://www.domain.com/'); |
22 | 24 |
23 url.hash = 'a'; | 25 url.hash = 'a'; |
24 assert_equals(url.hash, '#a'); | 26 assert_equals(url.hash, '#a'); |
25 | 27 |
26 url.hash = '#a'; | 28 url.hash = '#a'; |
27 assert_equals(url.hash, '#a'); | 29 assert_equals(url.hash, '#a'); |
28 | 30 |
29 url.hash = 'a#b'; | 31 url.hash = 'a#b'; |
30 assert_equals(url.hash, '#a#b'); | 32 assert_equals(url.hash, '#a#b'); |
31 }, 'Basic hash'); | 33 }, 'Basic hash'); |
(...skipping 18 matching lines...) Expand all Loading... |
50 | 52 |
51 test(function() { | 53 test(function() { |
52 var url = new URL('http://www.domain.com/'); | 54 var url = new URL('http://www.domain.com/'); |
53 assert_equals(url.hash, ''); | 55 assert_equals(url.hash, ''); |
54 | 56 |
55 url.hash = '\udc01\ud802a'; | 57 url.hash = '\udc01\ud802a'; |
56 assert_equals(url.hash, '#\ufffd\ufffda'); | 58 assert_equals(url.hash, '#\ufffd\ufffda'); |
57 }, 'hash with unmatched surrogates'); | 59 }, 'hash with unmatched surrogates'); |
58 | 60 |
59 </script> | 61 </script> |
OLD | NEW |