Override EventTarget.addEventListener

by JON

HTML

<button onclick="addListener()">Add Event Listener</button>
<button id="button">Click me!</button>

JavaScript

var f = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, fn, capture) {
    this.f = f;
    this.f(type, fn, capture);
    alert('Added Event Listener: on' + type);
}

function addListener() {
    var button = document.getElementById('button');
    button.addEventListener('click', function() { alert('clicked') }, false);
}