Last active
May 22, 2017 02:21
-
-
Save bmvakili/8c390edaa5ee0db4040f2a57abc68748 to your computer and use it in GitHub Desktop.
Revisions
-
Bijan Vakili revised this gist
May 22, 2017 . 2 changed files with 21 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ function logSortedCSSSelectorsOnStylesheets(stylesheets) { var ruleset = new Set(); for (var stylesheet in stylesheets) { var rules = stylesheets[stylesheet].rules; for (var rule in rules) { var stylesheetRule = rules[rule]; if (stylesheetRule.selectorText) { ruleset.add(stylesheetRule.selectorText); } } } ruleset = Array.from(ruleset).sort(); for (var rule in ruleset) { console.log(ruleset[rule]); } } var stylesheets = document.styleSheets; logSortedCSSSelectorsOnStylesheets(stylesheets); This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +0,0 @@ -
Bijan Vakili created this gist
May 22, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ var stylesheets = document.stylesheets; var ruleset = new Set(); for (var stylesheet in stylesheets) { var rules = stylesheets[stylesheet].rules; for (var rule in rules) { var stylesheetRule = rules[rule]; if (stylesheetRule.selectorText) { ruleset.add(stylesheetRule.selectorText); } } } ruleset = Array.from(ruleset).sort(); for (var rule in ruleset) { console.log(ruleset[rule]); }