<html>
<head>
<script>
function debug(str) {
	var d = document.getElementById('console');
	d.appendChild(document.createTextNode(str + '\n'));
}

function handler(event) {
    success = true;
}

function runTests() {
    if (window.testRunner)
        testRunner.dumpAsText();
    
    var b = document.getElementById('theButton')
    b.addEventListener('click', handler, true);
    
    success = false;
    b.click();
    if (success)
        debug("SUCCESS")
    else
        debug("FAILURE: event handler wasn't called")
}

</script>
</head>
<body onload="runTests();">
This tests that capturing event listeners will be invoked by events dispatched to the target which it has been added to.
<input id="theButton" type="button">
<pre id="console">
</pre>
</body>
</html>
