Question

How to trace or debug all available javascript events

How can I trace all Javascript events of a web page?

Is there a possibility to trace all events, even such without a handler attached?

Is there any tool out there, that can do this?

Clarification:

For example:

For a text input I can add an event handler for onblur and onchange.

If I (in the browser) change the value of the textfield and leave it, both eventhandlers are executed. Now I would like to know which other events I "have missed" (the ones which would have been executed if there was an eventhandler attached).

Clarification2:

Can I get a list(on a given element) of all possible events I can attach an eventhandler?

 45  53261  45
1 Jan 1970

Solution

 34

Here's a simple script to log all available events in the browser's console:

var ev = '',
    out = [];
for (ev in window) {
    if (/^on/.test(ev)) { 
        out[out.length] = ev;
    }
}
console.log(out.join(', '));

Of course you'll get only the events of the browser you're currently using.

2013-08-08