remove legacy code

This commit is contained in:
Niklas von Hertzen 2013-01-11 20:38:33 +02:00
parent 9b0c32c62c
commit 222dfa84b7

View File

@ -196,16 +196,15 @@ _html2canvas.Util.getCSS = function (el, attribute, index) {
return val;
}
if ( window.getComputedStyle ) {
if ( previousElement !== el ) {
if (previousElement !== el) {
computedCSS = document.defaultView.getComputedStyle(el, null);
}
val = computedCSS[ attribute ];
val = computedCSS[attribute];
if ( isBackgroundSizePosition ) {
if (isBackgroundSizePosition) {
val = (val || '').split( ',' );
val = val[index || 0] || val[0] || 'auto';
val = _html2canvas.Util.trimText( val ).split( ' ' );
val = _html2canvas.Util.trimText(val).split(' ');
if(attribute === 'backgroundSize' && (!val[ 0 ] || val[ 0 ].match( /cover|contain|auto/ ))) {
//these values will be handled in the parent function
@ -234,31 +233,6 @@ _html2canvas.Util.getCSS = function (el, attribute, index) {
val = arr;
}
} else if ( el.currentStyle ) {
// IE 9>
if ( isBackgroundSizePosition ) {
// Older IE uses -x and -y
val = [ toPX( attribute + "X", el.currentStyle[ attribute + "X" ] ), toPX( attribute + "Y", el.currentStyle[ attribute + "Y" ] ) ];
} else {
val = toPX( attribute, el.currentStyle[ attribute ] );
if (/^(border)/i.test( attribute ) && /^(medium|thin|thick)$/i.test( val )) {
switch (val) {
case "thin":
val = "1px";
break;
case "medium":
val = "0px"; // this is wrong, it should be 3px but IE uses medium for no border as well.. TODO find a work around
break;
case "thick":
val = "5px";
break;
}
}
}
}
return val;
};