Skip to content

Instantly share code, notes, and snippets.

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