Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get the difference in styles between two HTML nodes
function styleDelta(a, b) {
var aStyles = window.getComputedStyle(a)
, bStyles = window.getComputedStyle(b)
, delta = {}
Object.keys(aStyles).forEach(function(key) {
var aVal = aStyles[key]
, bVal = bStyles[key]
if (aVal != bVal) {
delta[key] = [aVal, bVal]
}
})
return delta
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.