Skip to content

Instantly share code, notes, and snippets.

@fitsum
Last active January 1, 2020 23:30
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 fitsum/85408d59afc9f82a0df87a3722675ce6 to your computer and use it in GitHub Desktop.
Save fitsum/85408d59afc9f82a0df87a3722675ce6 to your computer and use it in GitHub Desktop.
jstip from Lea Verou for capturing lists of DOM stuff using Set
list of classes
[...new Set($$("[class]").flatMap(e => [...e.classList]))]
list of elements
[...new Set($$("*").map(e => e.nodeName.toLowerCase()))]
Use * * * for elements inside <head> and <body> or body * for elements inside <body> only
from https://twitter.com/LeaVerou/status/1191059865223016448
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment