Created
August 11, 2015 17:00
-
-
Save hober/a29b6c28ac1744c800dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Radar 22169467</title> | |
<script> | |
function log(text) { | |
var logEl = document.getElementById("log"); | |
logEl.innerHTML = logEl.innerHTML + text + "<br>"; | |
} | |
function assert(test, description) { | |
if (test) { | |
log("PASS: " + description); | |
} else { | |
log("FAIL: " + description); | |
} | |
} | |
function testthebug() { | |
var newhash = "x" + location.hash.substring(1); | |
location.hash = newhash; | |
var syncval = location.hash; | |
setTimeout(function() { | |
var asyncval = location.hash; | |
assert(asyncval.substring(1)==newhash, | |
"After setting location.hash and spinning the runloop," | |
+ " getting location.hash should return the new value."); | |
assert(syncval==asyncval, | |
"You shouldn't have to setTimeout to get the new value."); | |
}, 10); | |
}; | |
window.onload = function() { | |
document.getElementsByTagName("button")[0].onclick = testthebug; | |
} | |
</script> | |
</head> | |
<body> | |
<p><button>Test</button></p> | |
<div id=log></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment