Skip to content

Instantly share code, notes, and snippets.

@mmuchin
Created October 19, 2012 01:32
Show Gist options
  • Save mmuchin/3915770 to your computer and use it in GitHub Desktop.
Save mmuchin/3915770 to your computer and use it in GitHub Desktop.
Chrome script to compare two elements values
(function(a,b){
var aComputed = getComputedStyle(a);
var bComputed = getComputedStyle(b);
console.log('------------------------------------------');
console.log('You are comparing: ');
console.log('A:', a);
console.log('B:', b);
console.log('------------------------------------------');
for(var aname in aComputed) {
var avalue = aComputed[aname];
var bvalue = bComputed[aname];
if( aname === 'length' || aname === 'cssText' || typeof avalue === "function" ) {
continue;
}
if( avalue !== bvalue ) {
console.warn('Attribute ' + aname + ' differs: ');
console.log('A:', avalue);
console.log('B:', bvalue);
}
}
console.log('------------------------------------------');
})($0,$1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment