Created
February 6, 2012 20:58
-
-
Save johnkpaul/1754808 to your computer and use it in GitHub Desktop.
Approximate cssText on a CSSStyleDeclaration object in Firefox
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
function getComputedStyleCssText(element){ | |
var cssObject = window.getComputedStyle(element), | |
prop, | |
cssText, | |
cssAccumulator = []; | |
if(cssObject.cssText != ""){ | |
return cssObject.cssText; | |
} | |
for(prop in cssObject){ | |
if(typeof cssObject[prop] == "string"){ | |
cssAccumulator.push(prop + " : " + cssObject[prop]); | |
} | |
} | |
return cssAccumulator.join("; "); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment