Last active
January 9, 2019 10:26
-
-
Save IpsumLorem16/eb1c185aa0df24cc4af49f3db673ec2a to your computer and use it in GitHub Desktop.
Gets all CSS classes in stylesheets and puts them into array Vanilla JS
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
let cssArray = []; | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
var styleSheet = document.styleSheets[i]; | |
for (var j = 0; j < 1; j++) { | |
let cssRules = styleSheet.cssRules; | |
for (var n = 0; n < cssRules.length; n++) { | |
cssArray.push(cssRules[n].selectorText); | |
} | |
} | |
} | |
console.log(cssArray + ' CSS Rules found'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment