2 <link rel=
"help" href=
"http://url.spec.whatwg.org/#dom-url-hash">
3 <script src=
"../../resources/testharness.js"></script>
4 <script src=
"../../resources/testharnessreport.js"></script>
8 var url
= new URL('http://www.domain.com/');
9 assert_equals(url
.hash
, '');
11 url
= new URL('http://www.domain.com/#');
12 assert_equals(url
.hash
, '');
14 url
= new URL('http://www.domain.com/#a');
15 assert_equals(url
.hash
, '#a');
18 assert_equals(url
.hash
, '');
19 assert_equals(url
.toString(), 'http://www.domain.com/');
22 assert_equals(url
.hash
, '');
23 assert_equals(url
.toString(), 'http://www.domain.com/');
26 assert_equals(url
.hash
, '#a');
29 assert_equals(url
.hash
, '#a');
32 assert_equals(url
.hash
, '#a#b');
36 var url
= new URL('mailto:foo@bar.com');
37 assert_equals(url
.hash
, '');
40 assert_equals(url
.hash
, '');
41 }, 'non hierarchical');
44 var url
= new URL('http://abc.de:8080/path/file?query#fragment');
46 assert_equals(url
.hash
, '');
49 assert_equals(url
.hash
, '');
50 assert_equals(url
.href
, 'invalid');
51 }, 'hash property invalid URL');
54 var url
= new URL('http://www.domain.com/');
55 assert_equals(url
.hash
, '');
57 url
.hash
= '\udc01\ud802a';
58 assert_equals(url
.hash
, '#\ufffd\ufffda');
59 }, 'hash with unmatched surrogates');