blob: 9017d3f2e0adfa3832db88a5a82ec466350af780 [file] [log] [blame]
<html>
<head>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function test()
{
document.getElementById("target").addEventListener("click", targetClick, true);
if (window.eventSender) {
eventSender.mouseMoveTo(52, 52);
eventSender.mouseDown();
eventSender.mouseUp();
window.setTimeout(finish, 0);
}
}
var finished = false;
function finish()
{
if (finished)
return;
finished = true;
log("targetClickFired: " + targetClickFired);
log("containerClickFired: " + containerClickFired);
if (targetClickFired && !containerClickFired)
log("test passed");
else
log("test failed");
if (window.layoutTestController)
layoutTestController.notifyDone();
}
function log(text) {
document.getElementById("result").innerHTML = document.getElementById("result").innerHTML + text + "<br>";
}
var targetClickFired = false;
var containerClickFired = false;
function targetClick(e) {
window.setTimeout(finish, 0);
targetClickFired = true;
e.stopPropagation();
e.preventDefault();
};
function containerClick(e) {
window.setTimeout(finish, 0);
containerClickFired = true;
};
</script>
</head>
<body onload="test()">
<p>This tests checks that capturing event handlers trigger on the node that is the target of the event, and that stopPropagation in such a handler prevents further bubble handlers from triggering.</p>
<div onclick="containerClick(event)">
<div style="position:absolute; top: 40; left: 40; width: 100; height: 40; background-color: pink" id="target" onclick="targetClick(event)">Click here</a>
</div>
<div id="result" style="position: absolute; top: 100; left: 50;"><br></div>
</body>
</html>