diff options
author | Oleg Gaidarenko <markelog@gmail.com> | 2015-09-03 02:52:01 +0300 |
---|---|---|
committer | Oleg Gaidarenko <markelog@gmail.com> | 2015-09-07 20:14:50 +0300 |
commit | 20ddbe4f594f78f7f1095050aabd91882dde0670 (patch) | |
tree | cec646466acf1470780105c743e72d52f5c691ba /src/css | |
parent | fa8a5a90e157f26a54ce50b4e8bb8f2f4bce3500 (diff) | |
download | jquery-20ddbe4f594f78f7f1095050aabd91882dde0670.tar.gz jquery-20ddbe4f594f78f7f1095050aabd91882dde0670.zip |
Build: Update jscs and lint files
Ref 10fdad742a2a6aa9f0e00b3e04fc5264797c53c7
Fixes gh-2056
Diffstat (limited to 'src/css')
-rw-r--r-- | src/css/addGetHookIf.js | 8 | ||||
-rw-r--r-- | src/css/adjustCSS.js | 10 | ||||
-rw-r--r-- | src/css/curCSS.js | 5 | ||||
-rw-r--r-- | src/css/hiddenVisibleSelectors.js | 4 | ||||
-rw-r--r-- | src/css/showHide.js | 5 | ||||
-rw-r--r-- | src/css/support.js | 17 | ||||
-rw-r--r-- | src/css/var/cssExpand.js | 4 | ||||
-rw-r--r-- | src/css/var/isHidden.js | 6 | ||||
-rw-r--r-- | src/css/var/rmargin.js | 6 | ||||
-rw-r--r-- | src/css/var/rnumnonpx.js | 4 | ||||
-rw-r--r-- | src/css/var/swap.js | 4 |
11 files changed, 44 insertions, 29 deletions
diff --git a/src/css/addGetHookIf.js b/src/css/addGetHookIf.js index e12f3598d..9cd21f683 100644 --- a/src/css/addGetHookIf.js +++ b/src/css/addGetHookIf.js @@ -1,10 +1,12 @@ -define(function() { +define( function() { function addGetHookIf( conditionFn, hookFn ) { + // Define the hook, we'll check on the first run if it's really needed. return { get: function() { if ( conditionFn() ) { + // Hook not needed (or it's not possible to use it due // to missing dependency), remove it. delete this.get; @@ -12,11 +14,11 @@ function addGetHookIf( conditionFn, hookFn ) { } // Hook needed; redefine it so that the support test is not executed again. - return (this.get = hookFn).apply( this, arguments ); + return ( this.get = hookFn ).apply( this, arguments ); } }; } return addGetHookIf; -}); +} ); diff --git a/src/css/adjustCSS.js b/src/css/adjustCSS.js index 05fddd15b..48fcfec05 100644 --- a/src/css/adjustCSS.js +++ b/src/css/adjustCSS.js @@ -1,4 +1,4 @@ -define([ +define( [ "../core", "../var/rcssNum" ], function( jQuery, rcssNum ) { @@ -12,11 +12,13 @@ function adjustCSS( elem, prop, valueParts, tween ) { function() { return jQuery.css( elem, prop, "" ); }, initial = currentValue(), unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + // Starting value computation is required for potential unit mismatches initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && rcssNum.exec( jQuery.css( elem, prop ) ); if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + // Trust units reported by jQuery.css unit = unit || initialInUnit[ 3 ]; @@ -27,6 +29,7 @@ function adjustCSS( elem, prop, valueParts, tween ) { initialInUnit = +initial || 1; do { + // If previous iteration zeroed out, double until we get *something*. // Use string for doubling so we don't accidentally see scale as unchanged below scale = scale || ".5"; @@ -38,12 +41,13 @@ function adjustCSS( elem, prop, valueParts, tween ) { // Update scale, tolerating zero or NaN from tween.cur() // Break the loop if scale is unchanged or perfect, or if we've just had enough. } while ( - scale !== (scale = currentValue() / initial) && scale !== 1 && --maxIterations + scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations ); } if ( valueParts ) { initialInUnit = +initialInUnit || +initial || 0; + // Apply relative offset (+=/-=) if specified adjusted = valueParts[ 1 ] ? initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : @@ -58,4 +62,4 @@ function adjustCSS( elem, prop, valueParts, tween ) { } return adjustCSS; -}); +} ); diff --git a/src/css/curCSS.js b/src/css/curCSS.js index 967ce3e94..8acf49038 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -1,4 +1,4 @@ -define([ +define( [ "exports", "../core", "../var/documentElement", @@ -13,6 +13,7 @@ var getStyles, curCSS, if ( window.getComputedStyle ) { getStyles = function( elem ) { + // Support: IE<=11+, Firefox<=30+ (#15098, #14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" @@ -120,4 +121,4 @@ if ( window.getComputedStyle ) { exports.getStyles = getStyles; exports.curCSS = curCSS; -}); +} ); diff --git a/src/css/hiddenVisibleSelectors.js b/src/css/hiddenVisibleSelectors.js index e340b16e6..46c2cb827 100644 --- a/src/css/hiddenVisibleSelectors.js +++ b/src/css/hiddenVisibleSelectors.js @@ -1,4 +1,4 @@ -define([ +define( [ "../core", "./support", "../selector", @@ -15,4 +15,4 @@ jQuery.expr.filters.visible = function( elem ) { ( ( elem.style && elem.style.display ) || jQuery.css( elem, "display" ) ) !== "none" ); }; -}); +} ); diff --git a/src/css/showHide.js b/src/css/showHide.js index f500f186f..efc1bdd3f 100644 --- a/src/css/showHide.js +++ b/src/css/showHide.js @@ -1,4 +1,4 @@ -define([], function() { +define( [], function() { function showHide( elements, show ) { var display, elem, @@ -16,6 +16,7 @@ function showHide( elements, show ) { display = elem.style.display; if ( show ) { if ( display === "none" ) { + // Restore a pre-hide() value if we have one values[ index ] = jQuery._data( elem, "display" ) || ""; } @@ -42,4 +43,4 @@ function showHide( elements, show ) { return showHide; -}); +} ); diff --git a/src/css/support.js b/src/css/support.js index 7eb3c7de4..96276a9e5 100644 --- a/src/css/support.js +++ b/src/css/support.js @@ -1,11 +1,11 @@ -define([ +define( [ "../core", "../var/document", "../var/documentElement", "../var/support" ], function( jQuery, document, documentElement, support ) { -(function() { +( function() { var pixelPositionVal, boxSizingReliableVal, gBCRDimensionsVal, pixelMarginRightVal, reliableHiddenOffsetsVal, reliableMarginRightVal, container = document.createElement( "div" ), @@ -36,7 +36,7 @@ define([ div.innerHTML = ""; container.appendChild( div ); - jQuery.extend(support, { + jQuery.extend( support, { reliableHiddenOffsets: function() { if ( pixelPositionVal == null ) { computeStyleTests(); @@ -45,6 +45,7 @@ define([ }, boxSizingReliable: function() { + // We're checking for pixelPositionVal here instead of boxSizingReliableVal // since that compresses better and they're computed together anyway. if ( pixelPositionVal == null ) { @@ -61,6 +62,7 @@ define([ }, pixelMarginRight: function() { + // Support: Android 4.0-4.3 if ( pixelPositionVal == null ) { computeStyleTests(); @@ -76,13 +78,14 @@ define([ }, reliableMarginRight: function() { + // Support: Android 2.3 if ( pixelPositionVal == null ) { computeStyleTests(); } return reliableMarginRightVal; } - }); + } ); function computeStyleTests() { var contents, divStyle, @@ -92,6 +95,7 @@ define([ documentElement.appendChild( container ); div.style.cssText = + // Support: Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:border-box;box-sizing:border-box;" + @@ -124,6 +128,7 @@ define([ // Reset CSS: box-sizing; display; margin; border; padding contents.style.cssText = div.style.cssText = + // Support: Android 2.3 // Vendor-prefix box-sizing "-webkit-box-sizing:content-box;box-sizing:content-box;" + @@ -158,8 +163,8 @@ define([ documentElement.removeChild( container ); } -})(); +} )(); return support; -}); +} ); diff --git a/src/css/var/cssExpand.js b/src/css/var/cssExpand.js index 91e90a88a..9f8194dc8 100644 --- a/src/css/var/cssExpand.js +++ b/src/css/var/cssExpand.js @@ -1,3 +1,3 @@ -define(function() { +define( function() { return [ "Top", "Right", "Bottom", "Left" ]; -}); +} ); diff --git a/src/css/var/isHidden.js b/src/css/var/isHidden.js index c29f527ae..7997efff1 100644 --- a/src/css/var/isHidden.js +++ b/src/css/var/isHidden.js @@ -1,14 +1,16 @@ -define([ +define( [ "../../core", "../../selector" + // css is assumed ], function( jQuery ) { return function( elem, el ) { + // isHidden might be called from jQuery#filter function; // in that case, element will be second argument elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); }; -}); +} ); diff --git a/src/css/var/rmargin.js b/src/css/var/rmargin.js index da0438db6..9be221243 100644 --- a/src/css/var/rmargin.js +++ b/src/css/var/rmargin.js @@ -1,3 +1,3 @@ -define(function() { - return (/^margin/); -}); +define( function() { + return ( /^margin/ ); +} ); diff --git a/src/css/var/rnumnonpx.js b/src/css/var/rnumnonpx.js index c93be2850..ed13f0b98 100644 --- a/src/css/var/rnumnonpx.js +++ b/src/css/var/rnumnonpx.js @@ -1,5 +1,5 @@ -define([ +define( [ "../../var/pnum" ], function( pnum ) { return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); -}); +} ); diff --git a/src/css/var/swap.js b/src/css/var/swap.js index dbf639729..b6d3b679f 100644 --- a/src/css/var/swap.js +++ b/src/css/var/swap.js @@ -1,4 +1,4 @@ -define(function() { +define( function() { // A method for quickly swapping in/out CSS properties to get correct calculations. return function( elem, options, callback, args ) { @@ -21,4 +21,4 @@ return function( elem, options, callback, args ) { return ret; }; -}); +} ); |