blob: 9048cbd404bf24874f9f99b41dfeac1d11299199 [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>Remove a Touch Target</title>
<style>
body {
margin: 0;
padding: 0;
}
.container {
position: absolute;
top: 10px;
left: 10px;
width: 50px;
height: 50px;
border: 1px solid green;
}
.target {
width: 40px;
height: 40px;
background-color: red;
}
#results {
position: absolute;
top: 100px;
}
</style>
<script src="resources/misc-touch-helpers.js"></script>
<script>
var seenTouch = false;
function targetTouched(event) {
logTouch(event);
if (!seenTouch) {
seenTouch = true;
debug("Now remove the element from its parent and attempt to touch it again. This touch should not register.");
var target = document.querySelector(".target");
target.parentNode.removeChild(target);
tapSoon(20, 20);
// Wait 50ms to see if the touch was registered. If it was, then we'll be exiting below.
setTimeout(function () {
debug("PASSED. We did not see a second touch.");
if (window.testRunner)
testRunner.notifyDone();
}, 50);
} else {
debug("FAILED. We saw a second touch.");
if (window.testRunner)
testRunner.notifyDone();
}
}
function init() {
var target = document.querySelector(".target");
target.addEventListener("touchstart", targetTouched, false);
debug("Should see only one touch at 20,20");
tapSoon(20, 20);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.addEventListener("load", init, false);
</script>
</head>
<body>
<div class="container">
<div class="target">
</div>
</div>
<div id="results">
</div>
</body>
</html>