Created
December 13, 2017 00:36
-
-
Save corse32/c74b3b178cefe9dc4171f18816f8351e to your computer and use it in GitHub Desktop.
JS (ES 6) one liner for extracting CSS rules from a DOM element
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
//blah is a reference to the dom node in question, e.g. const blah = document.getElementById('popover882889') | |
Array.from(window.getMatchedCSSRules(blah)).reduce((acc, rule) => `${acc} \n ${rule.cssText}`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment