2010-09-08 16:00:29 +00:00
|
|
|
(function( jQuery ) {
|
|
|
|
|
2010-09-28 15:57:20 +00:00
|
|
|
var ralpha = /alpha\([^)]*\)/i,
|
2009-07-19 16:13:45 +00:00
|
|
|
ropacity = /opacity=([^)]*)/,
|
2011-02-23 14:55:13 +00:00
|
|
|
// fixed for IE9, see #8346
|
2011-02-23 14:53:29 +00:00
|
|
|
rupper = /([A-Z]|^ms)/g,
|
2011-12-09 01:26:50 +00:00
|
|
|
rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
|
|
|
|
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
|
2011-08-26 14:44:50 +00:00
|
|
|
rrelNum = /^([\-+])=([\-+.\de]+)/,
|
2011-12-07 01:32:26 +00:00
|
|
|
rmargin = /^margin/,
|
2009-07-19 16:13:45 +00:00
|
|
|
|
2010-09-05 15:01:27 +00:00
|
|
|
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
2011-12-09 01:01:23 +00:00
|
|
|
|
|
|
|
// order is important!
|
|
|
|
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
|
|
|
|
|
2010-09-05 04:04:37 +00:00
|
|
|
curCSS,
|
2009-12-22 00:58:13 +00:00
|
|
|
|
2010-11-03 19:39:28 +00:00
|
|
|
getComputedStyle,
|
2011-05-25 19:10:49 +00:00
|
|
|
currentStyle;
|
2009-03-22 23:25:03 +00:00
|
|
|
|
|
|
|
jQuery.fn.css = function( name, value ) {
|
2011-12-06 20:25:38 +00:00
|
|
|
return jQuery.access( this, function( elem, name, value ) {
|
2010-09-17 18:41:28 +00:00
|
|
|
return value !== undefined ?
|
|
|
|
jQuery.style( elem, name, value ) :
|
|
|
|
jQuery.css( elem, name );
|
2011-12-06 20:25:38 +00:00
|
|
|
}, name, value, arguments.length > 1 );
|
2009-03-22 23:25:03 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.extend({
|
2010-09-16 14:00:56 +00:00
|
|
|
// Add in style property hooks for overriding the default
|
|
|
|
// behavior of getting and setting a style property
|
2010-09-05 15:01:27 +00:00
|
|
|
cssHooks: {
|
|
|
|
opacity: {
|
2010-09-27 15:51:01 +00:00
|
|
|
get: function( elem, computed ) {
|
|
|
|
if ( computed ) {
|
|
|
|
// We should always get a number back from opacity
|
2012-01-12 03:11:22 +00:00
|
|
|
var ret = curCSS( elem, "opacity" );
|
2010-09-27 15:51:01 +00:00
|
|
|
return ret === "" ? "1" : ret;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return elem.style.opacity;
|
|
|
|
}
|
2010-09-05 15:01:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Exclude the following css properties to add px
|
2010-09-05 15:01:27 +00:00
|
|
|
cssNumber: {
|
2011-06-14 19:59:22 +00:00
|
|
|
"fillOpacity": true,
|
2010-09-05 15:01:27 +00:00
|
|
|
"fontWeight": true,
|
2011-04-22 04:02:08 +00:00
|
|
|
"lineHeight": true,
|
2011-06-14 19:59:22 +00:00
|
|
|
"opacity": true,
|
|
|
|
"orphans": true,
|
2011-04-22 04:02:08 +00:00
|
|
|
"widows": true,
|
2011-06-14 19:59:22 +00:00
|
|
|
"zIndex": true,
|
|
|
|
"zoom": true
|
2010-09-05 15:01:27 +00:00
|
|
|
},
|
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Add in properties whose names you wish to fix before
|
|
|
|
// setting or getting the value
|
2010-09-05 15:01:27 +00:00
|
|
|
cssProps: {
|
|
|
|
// normalize float css property
|
|
|
|
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
|
|
|
|
},
|
2010-09-03 02:06:40 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Get and set the style property on a DOM Node
|
|
|
|
style: function( elem, name, value, extra ) {
|
|
|
|
// Don't set styles on text and comment nodes
|
|
|
|
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
|
2010-10-09 14:52:53 +00:00
|
|
|
return;
|
2010-09-03 02:06:40 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Make sure that we're working with the right name
|
2011-04-04 23:48:24 +00:00
|
|
|
var ret, type, origName = jQuery.camelCase( name ),
|
2010-09-16 14:00:56 +00:00
|
|
|
style = elem.style, hooks = jQuery.cssHooks[ origName ];
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-05 15:01:27 +00:00
|
|
|
name = jQuery.cssProps[ origName ] || origName;
|
2010-09-03 02:06:40 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Check if we're setting a value
|
2010-09-05 14:17:18 +00:00
|
|
|
if ( value !== undefined ) {
|
2011-04-04 23:48:24 +00:00
|
|
|
type = typeof value;
|
|
|
|
|
|
|
|
// convert relative number strings (+= or -=) to relative numbers. #7345
|
2011-08-16 22:00:44 +00:00
|
|
|
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
|
2011-08-16 23:25:32 +00:00
|
|
|
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
|
2011-05-13 16:09:49 +00:00
|
|
|
// Fixes bug #9237
|
2011-05-13 16:14:31 +00:00
|
|
|
type = "number";
|
2011-04-04 18:21:15 +00:00
|
|
|
}
|
|
|
|
|
2011-08-16 22:00:44 +00:00
|
|
|
// Make sure that NaN and null values aren't set. See: #7116
|
2011-08-16 23:30:20 +00:00
|
|
|
if ( value == null || type === "number" && isNaN( value ) ) {
|
2011-08-16 22:00:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// If a number was passed in, add 'px' to the (except for certain CSS properties)
|
2011-04-04 23:48:24 +00:00
|
|
|
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
|
2010-09-05 14:17:18 +00:00
|
|
|
value += "px";
|
2010-09-03 02:06:40 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// If a hook was provided, use that value, otherwise just set the specified value
|
|
|
|
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
|
2010-10-09 14:42:01 +00:00
|
|
|
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
|
|
|
|
// Fixes bug #5509
|
|
|
|
try {
|
|
|
|
style[ name ] = value;
|
|
|
|
} catch(e) {}
|
2009-07-19 16:08:17 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-05 14:17:18 +00:00
|
|
|
} else {
|
2010-09-16 14:00:56 +00:00
|
|
|
// If a hook was provided get the non-computed value from there
|
|
|
|
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
|
2010-09-05 14:17:18 +00:00
|
|
|
return ret;
|
2010-09-16 14:00:56 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Otherwise just get the value from the style object
|
|
|
|
return style[ name ];
|
|
|
|
}
|
|
|
|
},
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-17 18:41:28 +00:00
|
|
|
css: function( elem, name, extra ) {
|
2011-04-12 04:38:48 +00:00
|
|
|
var ret, hooks;
|
2011-04-11 18:33:52 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// Make sure that we're working with the right name
|
2011-04-11 18:33:52 +00:00
|
|
|
name = jQuery.camelCase( name );
|
|
|
|
hooks = jQuery.cssHooks[ name ];
|
|
|
|
name = jQuery.cssProps[ name ] || name;
|
2010-09-16 14:00:56 +00:00
|
|
|
|
2011-04-11 18:33:52 +00:00
|
|
|
// cssFloat needs a special treatment
|
2011-04-12 04:38:48 +00:00
|
|
|
if ( name === "cssFloat" ) {
|
|
|
|
name = "float";
|
2011-04-11 18:33:52 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// If a hook was provided get the computed value from there
|
2010-09-17 18:41:28 +00:00
|
|
|
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
|
2010-09-03 02:06:40 +00:00
|
|
|
return ret;
|
2010-09-16 14:00:56 +00:00
|
|
|
|
|
|
|
// Otherwise, if a way to get the computed value exists, use that
|
|
|
|
} else if ( curCSS ) {
|
2011-04-11 18:33:52 +00:00
|
|
|
return curCSS( elem, name );
|
2010-09-03 02:06:40 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
// A method for quickly swapping in/out CSS properties to get correct calculations
|
|
|
|
swap: function( elem, options, callback ) {
|
2011-12-06 21:23:22 +00:00
|
|
|
var old = {},
|
|
|
|
ret, name;
|
2009-07-19 16:08:17 +00:00
|
|
|
|
2009-03-22 23:25:03 +00:00
|
|
|
// Remember the old values, and insert the new ones
|
2011-12-06 21:23:22 +00:00
|
|
|
for ( name in options ) {
|
2009-03-22 23:25:03 +00:00
|
|
|
old[ name ] = elem.style[ name ];
|
|
|
|
elem.style[ name ] = options[ name ];
|
|
|
|
}
|
|
|
|
|
2011-12-06 21:23:22 +00:00
|
|
|
ret = callback.call( elem );
|
2009-03-22 23:25:03 +00:00
|
|
|
|
|
|
|
// Revert the old values
|
2010-03-02 02:24:49 +00:00
|
|
|
for ( name in options ) {
|
2009-03-22 23:25:03 +00:00
|
|
|
elem.style[ name ] = old[ name ];
|
2009-07-19 16:08:17 +00:00
|
|
|
}
|
2011-12-06 21:23:22 +00:00
|
|
|
|
|
|
|
return ret;
|
2009-03-22 23:25:03 +00:00
|
|
|
}
|
2009-07-19 13:21:51 +00:00
|
|
|
});
|
2009-10-26 22:07:57 +00:00
|
|
|
|
2010-09-17 18:41:28 +00:00
|
|
|
// DEPRECATED, Use jQuery.css() instead
|
|
|
|
jQuery.curCSS = jQuery.css;
|
|
|
|
|
2010-11-03 19:39:28 +00:00
|
|
|
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
2011-04-11 18:33:52 +00:00
|
|
|
getComputedStyle = function( elem, name ) {
|
2011-12-12 15:22:38 +00:00
|
|
|
var ret, defaultView, computedStyle, width,
|
|
|
|
style = elem.style;
|
2010-09-05 04:04:37 +00:00
|
|
|
|
|
|
|
name = name.replace( rupper, "-$1" ).toLowerCase();
|
|
|
|
|
2011-11-06 20:49:45 +00:00
|
|
|
if ( (defaultView = elem.ownerDocument.defaultView) &&
|
|
|
|
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
|
2011-12-12 15:22:38 +00:00
|
|
|
|
2010-09-05 04:04:37 +00:00
|
|
|
ret = computedStyle.getPropertyValue( name );
|
2010-10-11 19:11:03 +00:00
|
|
|
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
|
|
|
|
ret = jQuery.style( elem, name );
|
|
|
|
}
|
2010-09-05 04:04:37 +00:00
|
|
|
}
|
|
|
|
|
2011-12-07 01:32:26 +00:00
|
|
|
// A tribute to the "awesome hack by Dean Edwards"
|
|
|
|
// WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
|
|
|
|
// which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
|
2011-12-09 01:26:50 +00:00
|
|
|
if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
|
2011-12-07 01:32:26 +00:00
|
|
|
width = style.width;
|
|
|
|
style.width = ret;
|
|
|
|
ret = computedStyle.width;
|
|
|
|
style.width = width;
|
|
|
|
}
|
|
|
|
|
2010-11-03 22:59:55 +00:00
|
|
|
return ret;
|
2010-09-05 04:04:37 +00:00
|
|
|
};
|
2010-11-03 19:39:28 +00:00
|
|
|
}
|
2010-09-05 04:04:37 +00:00
|
|
|
|
2010-11-03 19:39:28 +00:00
|
|
|
if ( document.documentElement.currentStyle ) {
|
|
|
|
currentStyle = function( elem, name ) {
|
2011-11-01 13:46:20 +00:00
|
|
|
var left, rsLeft, uncomputed,
|
2010-11-09 16:09:07 +00:00
|
|
|
ret = elem.currentStyle && elem.currentStyle[ name ],
|
|
|
|
style = elem.style;
|
2010-09-05 04:04:37 +00:00
|
|
|
|
2011-11-01 13:46:20 +00:00
|
|
|
// Avoid setting ret to empty string here
|
|
|
|
// so we don't default to auto
|
2011-12-06 21:44:32 +00:00
|
|
|
if ( ret == null && style && (uncomputed = style[ name ]) ) {
|
2011-11-01 13:46:20 +00:00
|
|
|
ret = uncomputed;
|
2011-10-22 20:08:14 +00:00
|
|
|
}
|
|
|
|
|
2010-09-05 04:04:37 +00:00
|
|
|
// From the awesome hack by Dean Edwards
|
|
|
|
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
|
|
|
|
|
|
|
|
// If we're not dealing with a regular pixel number
|
|
|
|
// but a number that has a weird ending, we need to convert it to pixels
|
2011-12-09 01:26:50 +00:00
|
|
|
if ( rnumnonpx.test( ret ) ) {
|
2011-10-28 14:53:42 +00:00
|
|
|
|
2010-09-05 04:04:37 +00:00
|
|
|
// Remember the original values
|
|
|
|
left = style.left;
|
2011-10-28 14:53:42 +00:00
|
|
|
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
|
2010-09-05 04:04:37 +00:00
|
|
|
|
|
|
|
// Put in the new values to get a computed value out
|
2011-01-05 18:32:59 +00:00
|
|
|
if ( rsLeft ) {
|
|
|
|
elem.runtimeStyle.left = elem.currentStyle.left;
|
|
|
|
}
|
2011-12-07 01:32:26 +00:00
|
|
|
style.left = name === "fontSize" ? "1em" : ret;
|
2010-09-05 04:04:37 +00:00
|
|
|
ret = style.pixelLeft + "px";
|
|
|
|
|
|
|
|
// Revert the changed values
|
|
|
|
style.left = left;
|
2011-01-05 18:32:59 +00:00
|
|
|
if ( rsLeft ) {
|
|
|
|
elem.runtimeStyle.left = rsLeft;
|
|
|
|
}
|
2010-09-05 04:04:37 +00:00
|
|
|
}
|
|
|
|
|
2010-11-01 23:04:59 +00:00
|
|
|
return ret === "" ? "auto" : ret;
|
2010-09-05 04:04:37 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2010-11-03 19:39:28 +00:00
|
|
|
curCSS = getComputedStyle || currentStyle;
|
|
|
|
|
2011-12-09 01:01:23 +00:00
|
|
|
function getWidthOrHeight( elem, name, extra ) {
|
2011-04-14 19:49:15 +00:00
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
// Start with offset property
|
|
|
|
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
2011-12-09 01:01:23 +00:00
|
|
|
i = name === "width" ? 1 : 0,
|
|
|
|
len = 4;
|
2011-04-14 04:30:30 +00:00
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
if ( val > 0 ) {
|
2011-06-17 21:33:29 +00:00
|
|
|
if ( extra !== "border" ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
for ( ; i < len; i += 2 ) {
|
2011-06-17 21:33:29 +00:00
|
|
|
if ( !extra ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
|
2011-06-17 21:33:29 +00:00
|
|
|
}
|
|
|
|
if ( extra === "margin" ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
|
2011-06-17 21:33:29 +00:00
|
|
|
} else {
|
2011-12-09 01:01:23 +00:00
|
|
|
val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
|
2011-06-17 21:33:29 +00:00
|
|
|
}
|
2011-11-11 02:23:39 +00:00
|
|
|
}
|
2011-06-07 03:35:16 +00:00
|
|
|
}
|
2011-06-17 21:33:29 +00:00
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
return val + "px";
|
2011-06-07 03:13:37 +00:00
|
|
|
}
|
2011-04-14 19:49:15 +00:00
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
// Fall back to computed then uncomputed css if necessary
|
2012-01-12 03:11:22 +00:00
|
|
|
val = curCSS( elem, name );
|
2011-06-07 03:35:16 +00:00
|
|
|
if ( val < 0 || val == null ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
val = elem.style[ name ];
|
2011-06-07 03:35:16 +00:00
|
|
|
}
|
2011-12-12 15:22:38 +00:00
|
|
|
|
|
|
|
// Computed unit is not pixels. Stop here and return.
|
|
|
|
if ( rnumnonpx.test(val) ) {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
// Normalize "", auto, and prepare for extra
|
|
|
|
val = parseFloat( val ) || 0;
|
|
|
|
|
|
|
|
// Add padding, border, margin
|
|
|
|
if ( extra ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
for ( ; i < len; i += 2 ) {
|
|
|
|
val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
|
2011-06-07 03:35:16 +00:00
|
|
|
if ( extra !== "padding" ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
|
2011-06-07 03:35:16 +00:00
|
|
|
}
|
|
|
|
if ( extra === "margin" ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
|
2011-06-07 03:35:16 +00:00
|
|
|
}
|
2011-11-11 02:23:39 +00:00
|
|
|
}
|
2011-06-07 03:13:37 +00:00
|
|
|
}
|
|
|
|
|
2011-06-07 03:35:16 +00:00
|
|
|
return val + "px";
|
2010-03-01 17:44:56 +00:00
|
|
|
}
|
|
|
|
|
2011-12-12 15:22:38 +00:00
|
|
|
jQuery.each([ "height", "width" ], function( i, name ) {
|
|
|
|
jQuery.cssHooks[ name ] = {
|
|
|
|
get: function( elem, computed, extra ) {
|
|
|
|
if ( computed ) {
|
|
|
|
if ( elem.offsetWidth !== 0 ) {
|
|
|
|
return getWidthOrHeight( elem, name, extra );
|
|
|
|
} else {
|
|
|
|
return jQuery.swap( elem, cssShow, function() {
|
|
|
|
return getWidthOrHeight( elem, name, extra );
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function( elem, value ) {
|
|
|
|
return rnum.test( value ) ?
|
|
|
|
value + "px" :
|
|
|
|
value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
if ( !jQuery.support.opacity ) {
|
|
|
|
jQuery.cssHooks.opacity = {
|
|
|
|
get: function( elem, computed ) {
|
|
|
|
// IE uses filters for opacity
|
|
|
|
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
|
|
|
|
( parseFloat( RegExp.$1 ) / 100 ) + "" :
|
|
|
|
computed ? "1" : "";
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function( elem, value ) {
|
|
|
|
var style = elem.style,
|
|
|
|
currentStyle = elem.currentStyle,
|
|
|
|
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
|
|
|
|
filter = currentStyle && currentStyle.filter || style.filter || "";
|
|
|
|
|
|
|
|
// IE has trouble with opacity if it does not have layout
|
|
|
|
// Force it by setting the zoom level
|
|
|
|
style.zoom = 1;
|
|
|
|
|
|
|
|
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
|
|
|
|
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
|
|
|
|
|
|
|
|
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
|
|
|
|
// if "filter:" is present at all, clearType is disabled, we want to avoid this
|
|
|
|
// style.removeAttribute is IE Only, but so apparently is this code path...
|
|
|
|
style.removeAttribute( "filter" );
|
|
|
|
|
|
|
|
// if there there is no filter style applied in a css rule, we are done
|
|
|
|
if ( currentStyle && !currentStyle.filter ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// otherwise, set new filter values
|
|
|
|
style.filter = ralpha.test( filter ) ?
|
|
|
|
filter.replace( ralpha, opacity ) :
|
|
|
|
filter + " " + opacity;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
jQuery(function() {
|
|
|
|
// This hook cannot be added until DOM ready because the support test
|
|
|
|
// for it is not run until after DOM ready
|
|
|
|
if ( !jQuery.support.reliableMarginRight ) {
|
|
|
|
jQuery.cssHooks.marginRight = {
|
|
|
|
get: function( elem, computed ) {
|
|
|
|
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
|
|
|
// Work around by temporarily setting element display to inline-block
|
|
|
|
return jQuery.swap( elem, { "display": "inline-block" }, function() {
|
|
|
|
if ( computed ) {
|
2012-01-12 03:11:22 +00:00
|
|
|
return curCSS( elem, "margin-right" );
|
2011-12-12 15:22:38 +00:00
|
|
|
} else {
|
|
|
|
return elem.style.marginRight;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2009-10-26 22:07:57 +00:00
|
|
|
if ( jQuery.expr && jQuery.expr.filters ) {
|
2009-12-05 20:02:45 +00:00
|
|
|
jQuery.expr.filters.hidden = function( elem ) {
|
2010-11-09 16:09:07 +00:00
|
|
|
var width = elem.offsetWidth,
|
|
|
|
height = elem.offsetHeight;
|
2010-10-05 18:23:10 +00:00
|
|
|
|
2011-10-27 19:29:09 +00:00
|
|
|
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
|
2009-10-26 22:07:57 +00:00
|
|
|
};
|
|
|
|
|
2009-12-05 20:02:45 +00:00
|
|
|
jQuery.expr.filters.visible = function( elem ) {
|
|
|
|
return !jQuery.expr.filters.hidden( elem );
|
2009-10-26 22:07:57 +00:00
|
|
|
};
|
2009-11-11 19:17:16 +00:00
|
|
|
}
|
2010-09-08 16:00:29 +00:00
|
|
|
|
2011-12-09 01:01:23 +00:00
|
|
|
// These hooks are used by animate to expand properties
|
|
|
|
jQuery.each({
|
|
|
|
margin: "",
|
|
|
|
padding: "",
|
|
|
|
border: "Width"
|
|
|
|
}, function( prefix, suffix ) {
|
|
|
|
|
|
|
|
jQuery.cssHooks[ prefix + suffix ] = {
|
|
|
|
expand: function( value ) {
|
|
|
|
var i,
|
|
|
|
|
|
|
|
// assumes a single number if not a string
|
|
|
|
parts = typeof value === "string" ? value.split(" ") : [ value ],
|
|
|
|
expanded = {};
|
|
|
|
|
|
|
|
for ( i = 0; i < 4; i++ ) {
|
|
|
|
expanded[ prefix + cssExpand[ i ] + suffix ] =
|
|
|
|
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
return expanded;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2010-09-08 16:00:29 +00:00
|
|
|
})( jQuery );
|