Last active
December 22, 2015 11:59
-
-
Save boblauer/6469430 to your computer and use it in GitHub Desktop.
Revisions
-
boblauer renamed this gist
Sep 6, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
boblauer created this gist
Sep 6, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ (function() { var affected = [], unaffected = [], className; className = prompt('Class to check:'); if (!className) return; $('.' + className).each(function() { var element = this, $element = $(this), before = [], after = []; var styleProps = Object.keys(JSON.parse(JSON.stringify(element.style))); var before = [], after = []; styleProps.forEach(function(style) { before.push($element.css(style)); }); $element.removeClass(className); styleProps.forEach(function(style) { after.push($element.css(style)); }); $element.addClass(className); if (before.join('') === after.join('')) { unaffected.push(element); } else { affected.push(element); } }); console.log(affected.length + ' element(s) DO have styles applied from the ' + className + ' class.'); affected.forEach(function(el) { console.log(el); }); console.log(unaffected.length + ' element(s) do NOT have styles applied from the ' + className + ' class.'); unaffected.forEach(function(el) { console.log(el); }); })();