Just checking that DOM 3 useCapture works!

It does! At least on Safari 5.2 and Chrome 17. And that is good enough!!

by davidhong

HTML

<a href="#">Hello</a>
<button>Submit</button>

<div>Fun ain't it?</div>

CSS

div { width: 100px; height: 200px; background-color: red; }

JavaScript

(function (window) {
    var document = window.document,
        toString = Object.prototype.toString;
    
    function eventHandler (event) {
        var type = toString.call(event);
        console.log(type, event);
    }
    
    document.addEventListener('click', eventHandler, true);
    document.addEventListener('keyup', eventHandler, true);
}(this));