Skip to content

Instantly share code, notes, and snippets.

@revolter
Last active January 2, 2016 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revolter/8323002 to your computer and use it in GitHub Desktop.
Save revolter/8323002 to your computer and use it in GitHub Desktop.
Browser bookmarklet that returns all of the page's tags to use in a css reset.
javascript:function%20printTagNames(node){var%20nodes=node.childNodes;for(var%20i=0;i<nodes.length;i++){var%20tag=nodes[i].tagName;if(tag!=undefined){tag=tag.toLowerCase();if(!(tag%20in%20tagNames)&&exceptions.indexOf(tag)==-1){tagNames[tag]=true;}}if(nodes[i].hasChildNodes()){printTagNames(nodes[i]);}}}var%20tagNames={},exceptions=["audio","br","canvas","noscript","option","param","script","select","style"];printTagNames(document.body);alert("html,%20body,%20"+Object.keys(tagNames).join(",%20"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment