55 lines
2.0 KiB
HTML
55 lines
2.0 KiB
HTML
<html>
|
|
<head>
|
|
<title>link's hash property</title>
|
|
</head>
|
|
<body>
|
|
Hash and search properties should be non-empty only if they were specified.<br>
|
|
<br>
|
|
<a id="link1" href="http://localhost:3000">link w/o hash</a>
|
|
<a id="link2" href="http://localhost:3000/?#">link with empty hash</a>
|
|
<a id="link3" href="http://localhost:3000/?search#test">link with hash</a>
|
|
<div id="out"></div>
|
|
<script>
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
if (window.location.toString().charAt(window.location.toString().length - 1) != "#") {
|
|
if (location.hash != "" || location.search != "") {
|
|
out.innerHTML = "<br>Failure at step 1<br>"
|
|
+ "location.hash: " + location.hash + "<br>"
|
|
+ "link1.hash: " + link1.hash + "<br>"
|
|
+ "link2.hash: " + link2.hash + "<br>"
|
|
+ "link3.hash: " + link3.hash + "<br>"
|
|
+ "location.search: " + location.search + "<br>"
|
|
+ "link1.search: " + link1.search + "<br>"
|
|
+ "link2.search: " + link2.search + "<br>"
|
|
+ "link3.search: " + link3.search + "<br>"
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
} else
|
|
window.location += "?#";
|
|
|
|
} else { // Added "?#" and reloaded.
|
|
var link1 = document.getElementById("link1");
|
|
var link2 = document.getElementById("link2");
|
|
var out = document.getElementById("out");
|
|
out.innerHTML = "<br>"
|
|
+ "location.hash: " + location.hash + "<br>"
|
|
+ "link1.hash: " + link1.hash + "<br>"
|
|
+ "link2.hash: " + link2.hash + "<br>"
|
|
+ "link3.hash: " + link3.hash + "<br>"
|
|
+ "location.search: " + location.search + "<br>"
|
|
+ "link1.search: " + link1.search + "<br>"
|
|
+ "link2.search: " + link2.search + "<br>"
|
|
+ "link3.search: " + link3.search + "<br>"
|
|
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|