Skip to content

Instantly share code, notes, and snippets.

@signaes
Created October 1, 2020 18:44
Show Gist options
  • Save signaes/07ec80c26b25b88b06b31ccf9db4fbe5 to your computer and use it in GitHub Desktop.
Save signaes/07ec80c26b25b88b06b31ccf9db4fbe5 to your computer and use it in GitHub Desktop.
[].slice.call(document.querySelectorAll('*'))
.reduce((acc, x) => acc = x.getAttribute('class') ? acc.concat(x.getAttribute('class')) : acc, [])
.reduce((acc, x) => {
x.split(' ').forEach(c => {
if (acc.indexOf(c) === -1) {
acc.push(c);
}
});
return acc;
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment