Created
February 9, 2021 15:23
-
-
Save andydavies/a54e8785ee91c694ff070347a5756036 to your computer and use it in GitHub Desktop.
DevTools snippet to remove the document contents and any event handlers on document and window objects
This file contains hidden or 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.documentElement.innerHTML = ''; | |
for (const obj of [document, window]) { | |
for (const event of Object.values(getEventListeners(obj))) { | |
for (const {type, listener, useCapture} of event) { | |
obj.removeEventListener(type, listener, useCapture) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for (const obj of [document, window]) {
for (const event of Object.values(getEventListeners(obj))) {
for (const {type, listener, useCapture} of event) {
console.log(type, listener, useCapture)
}
}
}