blob: f4eeb8e2afcab2ec87486c448fe16e904c9b0474 [file] [log] [blame]
<html>
<body>
<div>
This test checks to make sure the hashchange event is fired __ansynchronously__ when the value of location.hash changes.<br/>
It assumes there is a hashchange event for each location.hash change.<br/>
<br/>
</div>
<div id="msg"></div>
</body>
<script language="javascript">
<!--
var hashChanging = false;
var failed = false;
var msgs = [];
var lc = window.testRunner;
if (lc) {
lc.dumpAsText();
lc.waitUntilDone();
}
function updateHash (hash) {
msgs.push('updateHash("' + hash + '")');
location.href = hash;
};
function loadHandler () {
hashChanging = true;
updateHash('#foo');
updateHash('#bar');
hashChanging = false;
};
var cnt = 0;
function hashChangeHandler () {
msgs.push('hashChangeHandler()');
if (hashChanging) {
failed = true;
}
if (++cnt == 2) {
msgs.push('', failed ? "FAILURE" : "SUCCESS");
document.getElementById("msg").innerHTML = msgs.join('<br/>');
if (lc) {
lc.notifyDone();
}
}
};
window.addEventListener('load', loadHandler, false);
window.addEventListener('hashchange', hashChangeHandler, false);
//-->
</script>
</html>