Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Last active June 22, 2022 13:21
Embed
What would you like to do?
Measure max DOM depth
Math.max(...[...document.querySelectorAll('*')].map(node => {
let count = 0
while ((node = node.parentNode)) { count++ }
return count
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment