Last active
April 9, 2019 16:39
-
-
Save JH108/81518fef54b4a93df83c7f1c28c43e55 to your computer and use it in GitHub Desktop.
Get all the event listeners on a page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[...document.querySelectorAll('*')] | |
.map((e) => ({ | |
element: e, | |
listeners: Object.keys(getEventListeners(e)) | |
.map((k) => ({ | |
event: k, | |
listeners: getEventListeners(e)[k] | |
})) | |
})) | |
.filter((item) => item.listeners.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment