3 <title>link's hash property
</title>
6 Hash and search properties should be non-empty only if they were specified.
<br>
8 <a id=
"link1" href=
"http://localhost:3000">link w/o hash
</a>
9 <a id=
"link2" href=
"http://localhost:3000/?#">link with empty hash
</a>
10 <a id=
"link3" href=
"http://localhost:3000/?search#test">link with hash
</a>
13 if (window
.testRunner
) {
14 testRunner
.dumpAsText();
15 testRunner
.waitUntilDone();
18 if (window
.location
.toString().charAt(window
.location
.toString().length
- 1) != "#") {
19 if (location
.hash
!= "" || location
.search
!= "") {
20 out
.innerHTML
= "<br>Failure at step 1<br>"
21 + "location.hash: " + location
.hash
+ "<br>"
22 + "link1.hash: " + link1
.hash
+ "<br>"
23 + "link2.hash: " + link2
.hash
+ "<br>"
24 + "link3.hash: " + link3
.hash
+ "<br>"
25 + "location.search: " + location
.search
+ "<br>"
26 + "link1.search: " + link1
.search
+ "<br>"
27 + "link2.search: " + link2
.search
+ "<br>"
28 + "link3.search: " + link3
.search
+ "<br>"
29 if (window
.testRunner
)
30 testRunner
.notifyDone();
32 window
.location
+= "?#";
34 } else { // Added "?#" and reloaded.
35 var link1
= document
.getElementById("link1");
36 var link2
= document
.getElementById("link2");
37 var out
= document
.getElementById("out");
38 out
.innerHTML
= "<br>"
39 + "location.hash: " + location
.hash
+ "<br>"
40 + "link1.hash: " + link1
.hash
+ "<br>"
41 + "link2.hash: " + link2
.hash
+ "<br>"
42 + "link3.hash: " + link3
.hash
+ "<br>"
43 + "location.search: " + location
.search
+ "<br>"
44 + "link1.search: " + link1
.search
+ "<br>"
45 + "link2.search: " + link2
.search
+ "<br>"
46 + "link3.search: " + link3
.search
+ "<br>"
48 if (window
.testRunner
)
49 testRunner
.notifyDone();