Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libs/bower_components/jquery/src/css.js')
-rw-r--r--libs/bower_components/jquery/src/css.js181
1 files changed, 120 insertions, 61 deletions
diff --git a/libs/bower_components/jquery/src/css.js b/libs/bower_components/jquery/src/css.js
index 2c88f2bc3c..e222ce7b42 100644
--- a/libs/bower_components/jquery/src/css.js
+++ b/libs/bower_components/jquery/src/css.js
@@ -1,34 +1,39 @@
-define([
+define( [
"./core",
"./var/pnum",
"./core/access",
"./css/var/rmargin",
+ "./var/document",
+ "./var/rcssNum",
"./css/var/rnumnonpx",
"./css/var/cssExpand",
"./css/var/isHidden",
+ "./css/var/swap",
"./css/curCSS",
+ "./css/adjustCSS",
"./css/defaultDisplay",
"./css/addGetHookIf",
"./css/support",
"./core/init",
- "./css/swap",
"./core/ready",
"./selector" // contains
-], function( jQuery, pnum, access, rmargin, rnumnonpx, cssExpand, isHidden,
- curCSS, defaultDisplay, addGetHookIf, support ) {
+], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand,
+ isHidden, swap, curCSS, adjustCSS, defaultDisplay, addGetHookIf, support ) {
var
+
// BuildExclude
getStyles = curCSS.getStyles,
ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity\s*=\s*([^)]*)/,
+ ropacity = /opacity\s*=\s*([^)]*)/i,
- // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
- // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+ // swappable if display is none or starts with table except
+ // "table", "table-cell", or "table-caption"
+ // see here for display values:
+ // https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
- rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
@@ -36,32 +41,30 @@ var
fontWeight: "400"
},
- cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
+ cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
+ emptyStyle = document.createElement( "div" ).style;
// BuildExclude
curCSS = curCSS.curCSS;
// return a css property mapped to a potentially vendor prefixed property
-function vendorPropName( style, name ) {
+function vendorPropName( name ) {
// shortcut for names that are not vendor prefixed
- if ( name in style ) {
+ if ( name in emptyStyle ) {
return name;
}
// check for vendor prefixed names
- var capName = name.charAt(0).toUpperCase() + name.slice(1),
- origName = name,
+ var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ),
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
- if ( name in style ) {
+ if ( name in emptyStyle ) {
return name;
}
}
-
- return origName;
}
function showHide( elements, show ) {
@@ -79,6 +82,7 @@ function showHide( elements, show ) {
values[ index ] = jQuery._data( elem, "olddisplay" );
display = elem.style.display;
if ( show ) {
+
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && display === "none" ) {
@@ -89,13 +93,18 @@ function showHide( elements, show ) {
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
- values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
+ values[ index ] =
+ jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) );
}
} else {
hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) {
- jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ jQuery._data(
+ elem,
+ "olddisplay",
+ hidden ? display : jQuery.css( elem, "display" )
+ );
}
}
}
@@ -118,6 +127,7 @@ function showHide( elements, show ) {
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;
@@ -125,20 +135,24 @@ function setPositiveNumber( elem, value, subtract ) {
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 ) {
+
// both box models exclude margin, so add it if we want it
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 );
@@ -149,6 +163,7 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
+
// at this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
@@ -168,12 +183,14 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ),
- isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
+ isBorderBox = support.boxSizing &&
+ jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// 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 ) {
@@ -181,13 +198,14 @@ function getWidthOrHeight( elem, name, extra ) {
}
// Computed unit is not pixels. Stop here and return.
- if ( rnumnonpx.test(val) ) {
+ if ( rnumnonpx.test( val ) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
- valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] );
+ valueIsBorderBox = isBorderBox &&
+ ( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
@@ -205,13 +223,15 @@ function getWidthOrHeight( elem, name, extra ) {
) + "px";
}
-jQuery.extend({
+jQuery.extend( {
+
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
+
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
@@ -222,6 +242,7 @@ jQuery.extend({
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
+ "animationIterationCount": true,
"columnCount": true,
"fillOpacity": true,
"flexGrow": true,
@@ -239,12 +260,14 @@ jQuery.extend({
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
+
// normalize float css property
"float": support.cssFloat ? "cssFloat" : "styleFloat"
},
// 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 ) {
return;
@@ -255,7 +278,8 @@ jQuery.extend({
origName = jQuery.camelCase( name ),
style = elem.style;
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+ name = jQuery.cssProps[ origName ] ||
+ ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version
// followed by the unprefixed version
@@ -265,9 +289,10 @@ jQuery.extend({
if ( value !== undefined ) {
type = typeof value;
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+ // Convert "+=" or "-=" to relative numbers (#7345)
+ if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
+ value = adjustCSS( elem, name, ret );
+
// Fixes bug #9237
type = "number";
}
@@ -277,30 +302,35 @@ jQuery.extend({
return;
}
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
+ // 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" );
}
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
- // but it would mean to define eight (for every problematic property) identical functions
- if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
+ // but it would mean to define eight
+ // (for every problematic property) identical functions
+ if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+ if ( !hooks || !( "set" in hooks ) ||
+ ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
// Support: IE
// Swallow errors from 'invalid' CSS values (#5509)
try {
style[ name ] = value;
- } catch(e) {}
+ } catch ( e ) {}
}
} else {
+
// If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+ if ( hooks && "get" in hooks &&
+ ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
+
return ret;
}
@@ -314,7 +344,8 @@ jQuery.extend({
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
- name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+ name = jQuery.cssProps[ origName ] ||
+ ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
// gets hook for the prefixed version
// followed by the unprefixed version
@@ -338,23 +369,25 @@ jQuery.extend({
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
- return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
+ return extra === true || isFinite( num ) ? num || 0 : val;
}
return val;
}
-});
+} );
-jQuery.each([ "height", "width" ], function( i, name ) {
+jQuery.each( [ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
+
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
- return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
- jQuery.swap( elem, cssShow, function() {
- return getWidthOrHeight( elem, name, extra );
- }) :
- getWidthOrHeight( elem, name, extra );
+ return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
+ elem.offsetWidth === 0 ?
+ swap( elem, cssShow, function() {
+ return getWidthOrHeight( elem, name, extra );
+ } ) :
+ getWidthOrHeight( elem, name, extra );
}
},
@@ -365,21 +398,25 @@ jQuery.each([ "height", "width" ], function( i, name ) {
elem,
name,
extra,
- support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
+ support.boxSizing &&
+ jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
) : 0
);
}
};
-});
+} );
if ( !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) || "" ) ?
- ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
- computed ? "1" : "";
+ return ropacity.test( ( computed && elem.currentStyle ?
+ elem.currentStyle.filter :
+ elem.style.filter ) || "" ) ?
+ ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+ computed ? "1" : "";
},
set: function( elem, value ) {
@@ -392,7 +429,8 @@ if ( !support.opacity ) {
// 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 setting opacity to 1, and no other filters exist -
+ // attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
@@ -403,7 +441,8 @@ if ( !support.opacity ) {
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
- // if there is no filter style applied in a css rule or unset inline opacity, we are done
+ // if there is no filter style applied in a css rule
+ // or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) {
return;
}
@@ -420,16 +459,36 @@ if ( !support.opacity ) {
jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
function( elem, computed ) {
if ( 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" },
+ return swap( elem, { "display": "inline-block" },
curCSS, [ elem, "marginRight" ] );
}
}
);
+jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
+ function( elem, computed ) {
+ if ( computed ) {
+ return (
+ parseFloat( curCSS( elem, "marginLeft" ) ) ||
+
+ // Support: IE<=11+
+ // Running getBoundingClientRect on a disconnected node in IE throws an error
+ // Support: IE8 only
+ // getClientRects() errors on disconnected elems
+ ( jQuery.contains( elem.ownerDocument, elem ) ?
+ elem.getBoundingClientRect().left -
+ swap( elem, { marginLeft: 0 }, function() {
+ return elem.getBoundingClientRect().left;
+ } ) :
+ 0
+ )
+ ) + "px";
+ }
+ }
+);
+
// These hooks are used by animate to expand properties
-jQuery.each({
+jQuery.each( {
margin: "",
padding: "",
border: "Width"
@@ -440,7 +499,7 @@ jQuery.each({
expanded = {},
// assumes a single number if not a string
- parts = typeof value === "string" ? value.split(" ") : [ value ];
+ parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
@@ -454,9 +513,9 @@ jQuery.each({
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
-});
+} );
-jQuery.fn.extend({
+jQuery.fn.extend( {
css: function( name, value ) {
return access( this, function( elem, name, value ) {
var styles, len,
@@ -490,15 +549,15 @@ jQuery.fn.extend({
return state ? this.show() : this.hide();
}
- return this.each(function() {
+ return this.each( function() {
if ( isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
- });
+ } );
}
-});
+} );
return jQuery;
-});
+} );