Last active
June 21, 2023 09:43
-
-
Save doeringp/7798b37e248f9b0a3421c3dcc133c70f to your computer and use it in GitHub Desktop.
Find a css class that is available on a web page
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
const findCssClass = (name) => | |
Array.from(document.querySelectorAll("[class]")) | |
.flatMap(e => Array.from(e.classList)) | |
.filter(s => s.indexOf(name) > -1) | |
findCssClass("text") | |
// => ['text-center', 'text-xl', '!text-sm', 'text-xl', 'text-center', 'text-center'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment