intercept *.addEventListener for debugging
✓ Published0🌍 Public
Aalessioalex
Last edited Aug 6, 2015
Created on Aug 5, 2015
This example demonstrates how to intercept and log every `addEventListener` call on HTML element prototypes for debugging purposes. It enumerates all `HTML*` interfaces from `window`, then wraps each prototype’s `addEventListener` method to print the event type, listener, and `useCapture` flag, followed by a stack trace via `console.trace()`. The code uses native browser APIs like `Object.getOwnPropertyNames`, `window`, and prototype manipulation, with no external libraries, and is based on a Stack Overflow solution adapted for Firefox.
AI-generated description