Last active
August 29, 2015 14:13
-
-
Save winkler1/027237941426b24ea151 to your computer and use it in GitHub Desktop.
Print DOM elements, dimensions, React ID's
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
console.clear(); | |
var all = document.getElementsByTagName("*"); | |
var TAGS_TO_SKIP=['BODY','HEAD','HTML','IFRAME','LABEL','LINK','NOSCRIPT','SCRIPT','STYLE','TITLE']; | |
for (var i=0, max=all.length; i < max; i++) { | |
var el=all[i]; | |
if (TAGS_TO_SKIP.indexOf(el.tagName) == -1 ) { | |
// var reactID=el.dataset.reactid; // You might want to do something with this.. | |
console.log(i, el.tagName,el, el.getBoundingClientRect()); | |
} | |
} | |
//--- As a bookmarklet: | |
javascript:(function(){ var all,TAGS_TO_SKIP,i,max,el;for(console.clear(),all=document.getElementsByTagName("*"),TAGS_TO_SKIP=["BODY","HEAD","HTML","IFRAME","LABEL","LINK","NOSCRIPT","SCRIPT","STYLE","TITLE"],i=0,max=all.length;max>i;i++)el=all[i],-1==TAGS_TO_SKIP.indexOf(el.tagName)&&console.log(i,el.tagName,el,el.getBoundingClientRect()) })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment