It should be possible to detect event handlers attached using <element>.addEventListener()
by intercepting calls to the function:
var myListOfAddedEvents = [];
var realAddEventListener = HTMLElement.prototype.addEventListener;
HTMLElement.prototype.addEventListener = function(evtType,fn,cap) {
myListOfAddedEvents.push(
{on: this, type: evtType, handler: fn, capture: cap}
);
return realAddEventListener.apply(this, arguments);
};
Note: That is untested code and may need some work. I'm hoping this same function will be used by all element types, but I could be wrong. Also it will only work if you can run this bit of code before they start adding events. A copy for attachEvent could be constructed similarly.