| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 
 |         document.cssProp = ['background','backgroundAttachment','backgroundColor','backgroundImage','backgroundPosition','backgroundRepeat','border','borderBottom','borderBottomColor','borderBottomStyle','borderBottomWidth','borderCollapse','borderColor','borderLeft','borderLeftColor','borderLeftStyle','borderLeftWidth','borderRight','borderRightColor','borderRightStyle','borderRightWidth','borderSpacing','borderStyle','borderTop','borderTopColor','borderTopStyle','borderTopWidth','borderWidth','bottom','captionSide','clear','clip','color','content','counterIncrement','counterReset','cssFloat','cursor','direction','display','emptyCells','float','font','fontFamily','fontSize','fontStyle','fontVariant','fontWeight','height','left','letterSpacing','lineHeight','listStyle','listStyleImage','listStylePosition','listStyleType','margin','marginBottom','marginLeft','marginRight','marginTop','maxHeight','maxWidth','minHeight','minWidth','orphans','outline','outlineColor','outlineStyle','outlineWidth','overflow','padding','paddingBottom','paddingLeft','paddingRight','paddingTop','pageBreakAfter','pageBreakBefore','pageBreakInside','position','quotes','right','styleFloat','tableLayout','textAlign','textDecoration','textIndent','textTransform','top','unicodeBidi','verticalAlign','visibility','whiteSpace','widows','width','wordSpacing','zIndex']
 
        function getStyle(el) {
          try { window.recalc(); } catch (ex) {}
          return (
            el.currentStyle ? el.currentSyle : (
              el.runtimeStyle ? el.runtimeStyle : (
                document.defaultView.getComputedStyle ? document.defaultView.getComputedStyle(el, null) : (
                  getComputedStyle(el, null)
                )
              )
            )
          );
        }
        function cssDiff(el1, el2) {
          var s1, s2; 
          if (!document.all) {
            s1=getStyle(el1); s2=getStyle(el2);
          } else {
            s1=el1.currentStyle;
            s2=el2.currentStyle;
          }
          var s3 = new Object();
          for (var j=0; j<document.cssProp.length; j++) {
            if (s2[document.cssProp[j]] != s1[document.cssProp[j]]) {
              s3[document.cssProp[j]] = s2[document.cssProp[j]];
            }
          }
          return s3;
        }
        function getCSS(className, callBack) {
            var el1 = document.createElement("div");
            var el2 = document.createElement("div");
            document.body.appendChild(el1);
            document.body.appendChild(el2);
            el2.className = className;
            var wait;
            wait = function () {
                if (document.all && (!el1.currentStyle || !el2.currentStyle)) {
                    setTimeout(wait, 10);
                    return null;
                } else {
                    var s = cssDiff(el1, el2);
                    document.body.removeChild(el1);
                    document.body.removeChild(el2);
                    callBack(s);
                }
            }
            setTimeout(wait, 10)
            return true;
        }
 
        window.onload = function() {
            getCSS("testClass", function(s) {
                var msg = "";
                for (key in s) {
                    msg+=key + " : " + s[key] + "; \n";
                }
                alert(msg);
            });
        } |