Created
March 12, 2011 20:53
-
-
Save alunny/867552 to your computer and use it in GitHub Desktop.
check which styles are different bw two html elements
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
// check which style properties are different between two DOM elements | |
// obv. needs a browser with getComputedStyle | |
function styleDiff(first, second) { | |
var oneStyle = getComputedStyle(first), | |
twoStyle = getComputedStyle(second), | |
diff = [], | |
i, | |
prop; | |
for (i = 0; i < oneStyle.length; i++) { | |
prop = oneStyle[i]; | |
if (oneStyle[prop] != twoStyle[prop]) diff.push(prop); | |
} | |
return diff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment