Skip to content

Instantly share code, notes, and snippets.

@cjzopen
Forked from ginpei/z-index-table.js
Created July 3, 2018 02:11
Show Gist options
  • Save cjzopen/003b18109fb92d0b9686db8146e61bd1 to your computer and use it in GitHub Desktop.
Save cjzopen/003b18109fb92d0b9686db8146e61bd1 to your computer and use it in GitHub Desktop.
((document, limit) => {
const data = Array.from(document.querySelectorAll('*'))
.map((el) => ({zIndex: Number(getComputedStyle(el).zIndex), element: el }))
.filter(({ zIndex }) => !isNaN(zIndex))
.sort((r1, r2) => r2.zIndex - r1.zIndex)
.slice(0, limit);
console.table(data);
})(document, 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment