define curCSS without temp vars to save 10 bytes

This commit is contained in:
Mike Sherov 2012-04-20 14:18:15 -04:00 committed by Rick Waldron waldron.rick@gmail.com
parent df2a22ee61
commit d3b61de520

View File

@ -15,9 +15,7 @@ var ralpha = /alpha\([^)]*\)/i,
cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "O", "Webkit", "Moz", "ms" ], cssPrefixes = [ "O", "Webkit", "Moz", "ms" ],
curCSS, curCSS;
getComputedStyle,
currentStyle;
// return a css property mapped to a potentially vendor prefixed property // return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) { function vendorPropName( style, name ) {
@ -198,7 +196,7 @@ jQuery.extend({
jQuery.curCSS = jQuery.css; jQuery.curCSS = jQuery.css;
if ( document.defaultView && document.defaultView.getComputedStyle ) { if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) { curCSS = function( elem, name ) {
var ret, defaultView, computedStyle, width, var ret, defaultView, computedStyle, width,
style = elem.style; style = elem.style;
@ -225,10 +223,8 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
return ret; return ret;
}; };
} } else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) {
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed, var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ], ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style; style = elem.style;
@ -268,8 +264,6 @@ if ( document.documentElement.currentStyle ) {
}; };
} }
curCSS = getComputedStyle || currentStyle;
function getWidthOrHeight( elem, name, extra ) { function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value // Start with offset property, which is equivalent to the border-box value