Created
March 8, 2018 17:17
-
-
Save XhmikosR/c03ffb588d3fcfb62f57f6985d00dc3c to your computer and use it in GitHub Desktop.
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
(function getDOMElements() { | |
'use strict'; | |
const elements = document.getElementsByTagName('*'); | |
const len = elements.length; | |
console.log(`Number of DOM elements: ${len}`); | |
if (len > 500) { | |
console.log('Skipping listing each element since they might hang the browser...'); | |
return; | |
} | |
Object.keys(elements).forEach((element) => { | |
console.log(`${element}:`, elements[element]); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment