Skip to content

Instantly share code, notes, and snippets.

@tolyod
Created March 6, 2020 13:49
Show Gist options
  • Save tolyod/8b588bd15cedc0ff3afd308c5b03f73a to your computer and use it in GitHub Desktop.
Save tolyod/8b588bd15cedc0ff3afd308c5b03f73a to your computer and use it in GitHub Desktop.
[...document.querySelector("#root-id").querySelectorAll('*')] // get root node and all childs
.reduce((acc, node) => [...acc, ...node.className.split(' ')],[]) // accomulate classNames
.filter((v, i, self) => self.indexOf(v) === i); // filter uniq classNames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment