Skip to content

Instantly share code, notes, and snippets.

@8bitDesigner
Created July 24, 2014 23:28

Revisions

  1. 8bitDesigner created this gist Jul 24, 2014.
    16 changes: 16 additions & 0 deletions delta.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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
    }