2013-10-15 14:40:48 +00:00
|
|
|
define([
|
|
|
|
"./core",
|
|
|
|
"./var/pnum",
|
|
|
|
"./core/access",
|
|
|
|
"./css/var/rmargin",
|
2015-05-11 21:23:09 +00:00
|
|
|
"./var/document",
|
2015-02-04 13:10:14 +00:00
|
|
|
"./var/rcssNum",
|
2013-10-15 14:40:48 +00:00
|
|
|
"./css/var/rnumnonpx",
|
|
|
|
"./css/var/cssExpand",
|
|
|
|
"./css/var/isHidden",
|
|
|
|
"./css/var/getStyles",
|
2015-03-30 17:19:15 +00:00
|
|
|
"./css/var/swap",
|
2013-10-15 14:40:48 +00:00
|
|
|
"./css/curCSS",
|
2015-02-04 13:10:14 +00:00
|
|
|
"./css/adjustCSS",
|
2013-10-15 14:40:48 +00:00
|
|
|
"./css/addGetHookIf",
|
|
|
|
"./css/support",
|
2015-04-02 20:57:33 +00:00
|
|
|
"./css/showHide",
|
2013-10-15 14:40:48 +00:00
|
|
|
|
|
|
|
"./core/init",
|
|
|
|
"./core/ready",
|
|
|
|
"./selector" // contains
|
2015-05-11 21:23:09 +00:00
|
|
|
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand,
|
|
|
|
isHidden, getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, showHide ) {
|
2013-09-09 15:26:21 +00:00
|
|
|
|
2013-09-09 13:54:52 +00:00
|
|
|
var
|
2014-07-17 17:25:59 +00:00
|
|
|
// Swappable if display is none or starts with table
|
|
|
|
// except "table", "table-cell", or "table-caption"
|
2014-04-25 22:26:36 +00:00
|
|
|
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
2012-08-29 12:50:56 +00:00
|
|
|
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
|
2013-08-15 18:15:49 +00:00
|
|
|
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
|
2012-06-06 23:03:10 +00:00
|
|
|
|
2012-07-23 02:23:32 +00:00
|
|
|
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
|
2012-06-06 23:03:10 +00:00
|
|
|
cssNormalTransform = {
|
2014-03-04 01:55:30 +00:00
|
|
|
letterSpacing: "0",
|
|
|
|
fontWeight: "400"
|
2012-07-23 02:23:32 +00:00
|
|
|
},
|
|
|
|
|
2015-05-11 21:23:09 +00:00
|
|
|
cssPrefixes = [ "Webkit", "Moz", "ms" ],
|
|
|
|
emptyStyle = document.createElement( "div" ).style;
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Return a css property mapped to a potentially vendor prefixed property
|
2015-05-11 21:23:09 +00:00
|
|
|
function vendorPropName( name ) {
|
2012-04-06 12:39:59 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Shortcut for names that are not vendor prefixed
|
2015-05-11 21:23:09 +00:00
|
|
|
if ( name in emptyStyle ) {
|
2012-04-06 12:39:59 +00:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Check for vendor prefixed names
|
2013-09-12 17:32:44 +00:00
|
|
|
var capName = name[0].toUpperCase() + name.slice(1),
|
2012-04-06 12:39:59 +00:00
|
|
|
i = cssPrefixes.length;
|
|
|
|
|
|
|
|
while ( i-- ) {
|
|
|
|
name = cssPrefixes[ i ] + capName;
|
2015-05-11 21:23:09 +00:00
|
|
|
if ( name in emptyStyle ) {
|
2012-04-06 12:39:59 +00:00
|
|
|
return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-09 13:54:52 +00:00
|
|
|
function setPositiveNumber( elem, value, subtract ) {
|
|
|
|
var matches = rnumsplit.exec( value );
|
|
|
|
return matches ?
|
|
|
|
// Guard against undefined "subtract", e.g., when used as in cssHooks
|
|
|
|
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
|
|
|
|
value;
|
|
|
|
}
|
|
|
|
|
|
|
|
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
|
|
|
|
var i = extra === ( isBorderBox ? "border" : "content" ) ?
|
|
|
|
// If we already have the right measurement, avoid augmentation
|
|
|
|
4 :
|
|
|
|
// Otherwise initialize for horizontal or vertical properties
|
|
|
|
name === "width" ? 1 : 0,
|
|
|
|
|
|
|
|
val = 0;
|
|
|
|
|
|
|
|
for ( ; i < 4; i += 2 ) {
|
2014-04-25 22:26:36 +00:00
|
|
|
// Both box models exclude margin, so add it if we want it
|
2013-09-09 13:54:52 +00:00
|
|
|
if ( extra === "margin" ) {
|
|
|
|
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( isBorderBox ) {
|
|
|
|
// border-box includes padding, so remove it if we want content
|
|
|
|
if ( extra === "content" ) {
|
|
|
|
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// At this point, extra isn't border nor margin, so remove border
|
2013-09-09 13:54:52 +00:00
|
|
|
if ( extra !== "margin" ) {
|
|
|
|
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
|
|
|
}
|
|
|
|
} else {
|
2014-04-25 22:26:36 +00:00
|
|
|
// At this point, extra isn't content, so add padding
|
2013-09-09 13:54:52 +00:00
|
|
|
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// At this point, extra isn't content nor padding, so add border
|
2013-09-09 13:54:52 +00:00
|
|
|
if ( extra !== "padding" ) {
|
|
|
|
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getWidthOrHeight( elem, name, extra ) {
|
|
|
|
|
|
|
|
// Start with offset property, which is equivalent to the border-box value
|
|
|
|
var valueIsBorderBox = true,
|
|
|
|
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
|
|
|
|
styles = getStyles( elem ),
|
|
|
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
|
|
|
|
2015-06-16 21:55:21 +00:00
|
|
|
// Support: IE11 only
|
|
|
|
// Fix for edge case in IE 11. See gh-1764
|
|
|
|
if ( document.msFullscreenElement && window.top !== window ) {
|
|
|
|
// Support: IE11 only
|
|
|
|
// Running getBoundingClientRect on a disconnected node
|
|
|
|
// in IE throws an error.
|
|
|
|
if ( elem.getClientRects().length ) {
|
|
|
|
val = Math.round( elem.getBoundingClientRect()[ name ] * 100 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Some non-html elements return undefined for offsetWidth, so check for null/undefined
|
2013-09-09 13:54:52 +00:00
|
|
|
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
|
|
|
|
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
|
|
|
|
if ( val <= 0 || val == null ) {
|
|
|
|
// Fall back to computed then uncomputed css if necessary
|
|
|
|
val = curCSS( elem, name, styles );
|
|
|
|
if ( val < 0 || val == null ) {
|
|
|
|
val = elem.style[ name ];
|
|
|
|
}
|
|
|
|
|
|
|
|
// Computed unit is not pixels. Stop here and return.
|
|
|
|
if ( rnumnonpx.test(val) ) {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Check for style in case a browser which returns unreliable values
|
2013-09-09 13:54:52 +00:00
|
|
|
// for getComputedStyle silently falls back to the reliable elem.style
|
|
|
|
valueIsBorderBox = isBorderBox &&
|
|
|
|
( support.boxSizingReliable() || val === elem.style[ name ] );
|
|
|
|
|
|
|
|
// Normalize "", auto, and prepare for extra
|
|
|
|
val = parseFloat( val ) || 0;
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Use the active box-sizing model to add/subtract irrelevant styles
|
2013-09-09 13:54:52 +00:00
|
|
|
return ( val +
|
|
|
|
augmentWidthOrHeight(
|
|
|
|
elem,
|
|
|
|
name,
|
|
|
|
extra || ( isBorderBox ? "border" : "content" ),
|
|
|
|
valueIsBorderBox,
|
|
|
|
styles
|
|
|
|
)
|
|
|
|
) + "px";
|
|
|
|
}
|
|
|
|
|
2009-03-22 23:25:03 +00:00
|
|
|
jQuery.extend({
|
2014-04-25 22:26:36 +00:00
|
|
|
|
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 ) {
|
2014-04-25 22:26:36 +00:00
|
|
|
|
2010-09-27 15:51:01 +00:00
|
|
|
// 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;
|
|
|
|
}
|
2010-09-05 15:01:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2013-05-09 02:56:51 +00:00
|
|
|
// Don't automatically add "px" to these possibly-unitless properties
|
2010-09-05 15:01:27 +00:00
|
|
|
cssNumber: {
|
2012-12-01 22:11:56 +00:00
|
|
|
"columnCount": true,
|
2011-06-14 19:59:22 +00:00
|
|
|
"fillOpacity": true,
|
2014-03-10 18:30:22 +00:00
|
|
|
"flexGrow": true,
|
|
|
|
"flexShrink": 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,
|
2013-06-28 23:08:16 +00:00
|
|
|
"order": true,
|
2011-06-14 19:59:22 +00:00
|
|
|
"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: {
|
2013-01-03 02:32:43 +00:00
|
|
|
"float": "cssFloat"
|
2010-09-05 15:01:27 +00:00
|
|
|
},
|
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 ) {
|
2014-04-25 22:26:36 +00:00
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// 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
|
2012-04-06 12:39:59 +00:00
|
|
|
var ret, type, hooks,
|
|
|
|
origName = jQuery.camelCase( name ),
|
|
|
|
style = elem.style;
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2014-07-17 17:25:59 +00:00
|
|
|
name = jQuery.cssProps[ origName ] ||
|
2015-05-11 21:23:09 +00:00
|
|
|
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
|
2012-04-06 12:39:59 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Gets hook for the prefixed version, then unprefixed version
|
2012-04-06 12:39:59 +00:00
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ 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;
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Convert "+=" or "-=" to relative numbers (#7345)
|
2015-02-04 13:10:14 +00:00
|
|
|
if ( type === "string" && (ret = rcssNum.exec( value )) && ret[ 1 ] ) {
|
|
|
|
value = adjustCSS( elem, name, ret );
|
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
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Make sure that null and NaN values aren't set (#7116)
|
2013-09-05 18:04:11 +00:00
|
|
|
if ( value == null || value !== value ) {
|
2011-08-16 22:00:44 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-02-04 13:10:14 +00:00
|
|
|
// If a number was passed in, add the unit (except for certain CSS properties)
|
|
|
|
if ( type === "number" ) {
|
|
|
|
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
|
2010-09-03 02:06:40 +00:00
|
|
|
}
|
2009-03-22 23:25:03 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Support: IE9-11+
|
|
|
|
// background-* props affect original clone's values
|
2013-08-26 22:54:13 +00:00
|
|
|
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
|
2013-01-08 02:08:47 +00:00
|
|
|
style[ name ] = "inherit";
|
2012-11-18 22:03:38 +00:00
|
|
|
}
|
|
|
|
|
2010-09-16 14:00:56 +00:00
|
|
|
// If a hook was provided, use that value, otherwise just set the specified value
|
2014-07-17 17:25:59 +00:00
|
|
|
if ( !hooks || !("set" in hooks) ||
|
|
|
|
(value = hooks.set( elem, value, extra )) !== undefined ) {
|
|
|
|
|
2013-01-08 02:08:47 +00:00
|
|
|
style[ name ] = value;
|
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
|
2014-07-17 17:25:59 +00:00
|
|
|
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
|
|
|
|
2012-12-10 23:25:23 +00:00
|
|
|
css: function( elem, name, extra, styles ) {
|
2012-05-25 01:52:35 +00:00
|
|
|
var val, num, hooks,
|
2012-04-06 12:39:59 +00:00
|
|
|
origName = jQuery.camelCase( name );
|
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
|
2014-07-17 17:25:59 +00:00
|
|
|
name = jQuery.cssProps[ origName ] ||
|
2015-05-11 21:23:09 +00:00
|
|
|
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
|
2012-04-06 12:39:59 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Try prefixed name followed by the unprefixed name
|
2012-04-06 12:39:59 +00:00
|
|
|
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
|
2010-09-16 14:00:56 +00:00
|
|
|
|
|
|
|
// If a hook was provided get the computed value from there
|
2012-05-25 01:52:35 +00:00
|
|
|
if ( hooks && "get" in hooks ) {
|
|
|
|
val = hooks.get( elem, true, extra );
|
|
|
|
}
|
2010-09-16 14:00:56 +00:00
|
|
|
|
|
|
|
// Otherwise, if a way to get the computed value exists, use that
|
2012-05-25 01:52:35 +00:00
|
|
|
if ( val === undefined ) {
|
2012-12-10 23:25:23 +00:00
|
|
|
val = curCSS( elem, name, styles );
|
2010-09-03 02:06:40 +00:00
|
|
|
}
|
2012-05-25 01:52:35 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Convert "normal" to computed value
|
2012-06-06 23:03:10 +00:00
|
|
|
if ( val === "normal" && name in cssNormalTransform ) {
|
|
|
|
val = cssNormalTransform[ name ];
|
|
|
|
}
|
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Make numeric if forced or a qualifier was provided and val looks numeric
|
2013-01-16 04:09:35 +00:00
|
|
|
if ( extra === "" || extra ) {
|
2012-05-25 01:52:35 +00:00
|
|
|
num = parseFloat( val );
|
2012-12-10 23:25:23 +00:00
|
|
|
return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
|
2012-05-25 01:52:35 +00:00
|
|
|
}
|
|
|
|
return val;
|
2009-03-22 23:25:03 +00:00
|
|
|
}
|
2009-07-19 13:21:51 +00:00
|
|
|
});
|
2009-10-26 22:07:57 +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 ) {
|
2014-04-25 22:26:36 +00:00
|
|
|
|
|
|
|
// Certain elements can have dimension info if we invisibly show them
|
|
|
|
// but it must have a current display style that would benefit
|
2014-07-17 17:25:59 +00:00
|
|
|
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
|
|
|
|
elem.offsetWidth === 0 ?
|
2015-03-30 17:19:15 +00:00
|
|
|
swap( elem, cssShow, function() {
|
2014-07-17 17:25:59 +00:00
|
|
|
return getWidthOrHeight( elem, name, extra );
|
|
|
|
}) :
|
|
|
|
getWidthOrHeight( elem, name, extra );
|
2011-12-12 15:22:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2012-05-21 17:44:19 +00:00
|
|
|
set: function( elem, value, extra ) {
|
2012-12-10 23:25:23 +00:00
|
|
|
var styles = extra && getStyles( elem );
|
2012-05-21 17:44:19 +00:00
|
|
|
return setPositiveNumber( elem, value, extra ?
|
|
|
|
augmentWidthOrHeight(
|
|
|
|
elem,
|
2012-05-25 01:52:35 +00:00
|
|
|
name,
|
2012-05-21 17:44:19 +00:00
|
|
|
extra,
|
2013-08-26 22:54:13 +00:00
|
|
|
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
2012-12-10 23:25:23 +00:00
|
|
|
styles
|
2012-05-21 17:44:19 +00:00
|
|
|
) : 0
|
|
|
|
);
|
|
|
|
}
|
2011-12-12 15:22:38 +00:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2013-08-26 22:54:13 +00:00
|
|
|
// Support: Android 2.3
|
2013-09-11 13:41:48 +00:00
|
|
|
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
|
2013-10-06 04:21:40 +00:00
|
|
|
function( elem, computed ) {
|
2013-09-11 00:45:11 +00:00
|
|
|
if ( computed ) {
|
2015-03-30 17:19:15 +00:00
|
|
|
return swap( elem, { "display": "inline-block" },
|
2013-09-11 00:45:11 +00:00
|
|
|
curCSS, [ elem, "marginRight" ] );
|
2013-08-26 22:54:13 +00:00
|
|
|
}
|
2011-12-12 15:22:38 +00:00
|
|
|
}
|
2013-09-11 00:45:11 +00:00
|
|
|
);
|
2012-06-16 01:20:41 +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 ) {
|
2012-12-11 04:39:08 +00:00
|
|
|
var i = 0,
|
2012-12-13 17:40:55 +00:00
|
|
|
expanded = {},
|
2011-12-09 01:01:23 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Assumes a single number if not a string
|
2012-12-13 17:40:55 +00:00
|
|
|
parts = typeof value === "string" ? value.split(" ") : [ value ];
|
2011-12-09 01:01:23 +00:00
|
|
|
|
2012-12-11 04:39:08 +00:00
|
|
|
for ( ; i < 4; i++ ) {
|
2011-12-09 01:01:23 +00:00
|
|
|
expanded[ prefix + cssExpand[ i ] + suffix ] =
|
|
|
|
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
|
|
|
|
}
|
|
|
|
|
|
|
|
return expanded;
|
|
|
|
}
|
|
|
|
};
|
2012-04-23 19:05:12 +00:00
|
|
|
|
|
|
|
if ( !rmargin.test( prefix ) ) {
|
|
|
|
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
|
|
|
|
}
|
2011-12-09 01:01:23 +00:00
|
|
|
});
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2013-09-09 13:54:52 +00:00
|
|
|
jQuery.fn.extend({
|
|
|
|
css: function( name, value ) {
|
2013-09-09 15:26:21 +00:00
|
|
|
return access( this, function( elem, name, value ) {
|
2013-09-09 13:54:52 +00:00
|
|
|
var styles, len,
|
|
|
|
map = {},
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
if ( jQuery.isArray( name ) ) {
|
|
|
|
styles = getStyles( elem );
|
|
|
|
len = name.length;
|
|
|
|
|
|
|
|
for ( ; i < len; i++ ) {
|
|
|
|
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
|
|
|
|
}
|
|
|
|
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
return value !== undefined ?
|
|
|
|
jQuery.style( elem, name, value ) :
|
|
|
|
jQuery.css( elem, name );
|
|
|
|
}, name, value, arguments.length > 1 );
|
|
|
|
},
|
|
|
|
show: function() {
|
|
|
|
return showHide( this, true );
|
|
|
|
},
|
|
|
|
hide: function() {
|
|
|
|
return showHide( this );
|
|
|
|
},
|
|
|
|
toggle: function( state ) {
|
|
|
|
if ( typeof state === "boolean" ) {
|
|
|
|
return state ? this.show() : this.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.each(function() {
|
|
|
|
if ( isHidden( this ) ) {
|
|
|
|
jQuery( this ).show();
|
|
|
|
} else {
|
|
|
|
jQuery( this ).hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-09-09 01:25:27 +00:00
|
|
|
return jQuery;
|
2013-08-15 18:15:49 +00:00
|
|
|
});
|