Skip to content

Instantly share code, notes, and snippets.

View thepeoplesbourgeois's full-sized avatar
🐢
turtles all the way down

thepeoplesbourgeois

🐢
turtles all the way down
  • ............. Earth.
View GitHub Profile
@thepeoplesbourgeois
thepeoplesbourgeois / allEventListeners.js
Last active September 1, 2023 02:18 — forked from tkafka/listAllEventListeners.js
List all event listeners in a document
function allEventListeners(){
const eventNames = Object.keys(window).filter(key => /^on/.test(key))
return [...document.querySelectorAll('*'), document].flatMap((node) => eventNames
.filter(event => node[event])
.map(event => {
return {
node,
event,
listener: (typeof node[event] === 'function') ? node[event].toString() : node[event]
}