Advertisement
Guest User

Structure Checker

a guest
Jul 7th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function() {
  2.     var
  3.         $old=window.$old=$()
  4.         ,$old2=$();
  5.     (function anon() {
  6.         var
  7.             length=0
  8.             ,$bad=$(
  9.                 '[width],[height],[style][style!=""]:not([style$=";"])'
  10.                 +',img:not([alt]),img[alt="Move"],img[alt="Edit"],img[alt="Delete"]'
  11.             )
  12.                 .add($('col').parent(':not(colgroup)'))
  13.                 .add($('tr').parent(':not(thead,tbody,tfoot)'))
  14.                 .add($('th,td').parent(':not(tr)'))
  15.                 .not($old);
  16.         //$old2=$old2.add($('img').not($old2).css({backgroundColor:'rgba(0,255,0,0.3)',outline:'0.2em solid purple'}));
  17.         length=$bad
  18.             .css({
  19.                 zIndex:1000
  20.                 ,minWidth:16
  21.                 ,minHeight:16
  22.                 ,outline:'1px solid black'
  23.                 ,backgroundColor:'rgba(255,0,0,0.5)'
  24.                 ,color:'#0ff'
  25.             })
  26.             .length;
  27.         if (length) {
  28.             console.log($bad,$bad.map(function() {return [[this.tagName||this.nodeName,this.id,this.name]];}).get());
  29.             alert(length+' Bad elements found!\n');
  30.         }
  31.         $old=$bad.add($old);
  32.         $old.css({visibility:function(k,v) {return (v==='visible' ? 'hidden' : 'visible');}});
  33.         setTimeout(anon,500);
  34.     }());
  35. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement