diff options
Diffstat (limited to 'ui/jquery.ui.effect.js')
-rw-r--r-- | ui/jquery.ui.effect.js | 78 |
1 files changed, 25 insertions, 53 deletions
diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index d5d306783..fee3359bf 100644 --- a/ui/jquery.ui.effect.js +++ b/ui/jquery.ui.effect.js @@ -10,9 +10,7 @@ */ ;(jQuery.effects || (function($, undefined) { -var backCompat = $.uiBackCompat !== false, - // prefix used for storing data on .data() - dataSpace = "ui-effects-"; +var dataSpace = "ui-effects-"; $.effects = { effect: {} @@ -245,8 +243,7 @@ color.fn = jQuery.extend( color.prototype, { var inst = this, type = jQuery.type( red ), - rgba = this._rgba = [], - source; + rgba = this._rgba = []; // more than 1 argument specified - assume ( red, green, blue, alpha ) if ( green !== undefined ) { @@ -427,7 +424,7 @@ color.fn = jQuery.extend( color.prototype, { rgba.push( ~~( alpha * 255 ) ); } - return "#" + jQuery.map( rgba, function( v, i ) { + return "#" + jQuery.map( rgba, function( v ) { // default to 0 when nulls exist v = ( v || 0 ).toString( 16 ); @@ -501,8 +498,7 @@ spaces.hsla.from = function ( hsla ) { l = hsla[ 2 ], a = hsla[ 3 ], q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s, - p = 2 * l - q, - r, g, b; + p = 2 * l - q; return [ Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ), @@ -619,7 +615,7 @@ each( stepHooks, function( i, hook ) { } try { elem.style[ hook ] = value; - } catch( value ) { + } catch( error ) { // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' } } @@ -704,33 +700,31 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS }; }); -function getElementStyles() { - var style = this.ownerDocument.defaultView ? - this.ownerDocument.defaultView.getComputedStyle( this, null ) : - this.currentStyle, - newStyle = {}, - key, - camelCase, - len; +function getElementStyles( elem ) { + var key, len, + style = elem.ownerDocument.defaultView ? + elem.ownerDocument.defaultView.getComputedStyle( elem, null ) : + elem.currentStyle, + styles = {}; - // webkit enumerates style porperties if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) { len = style.length; while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { - newStyle[ $.camelCase( key ) ] = style[ key ]; + styles[ $.camelCase( key ) ] = style[ key ]; } } + // support: Opera, IE <9 } else { for ( key in style ) { if ( typeof style[ key ] === "string" ) { - newStyle[ key ] = style[ key ]; + styles[ key ] = style[ key ]; } } } - return newStyle; + return styles; } @@ -766,7 +760,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) { var el = $( this ); return { el: el, - start: getElementStyles.call( this ) + start: getElementStyles( this ) }; }); @@ -782,7 +776,7 @@ $.effects.animateClass = function( value, duration, easing, callback ) { // map all animated objects again - calculate new styles and diff allAnimations = allAnimations.map(function() { - this.end = getElementStyles.call( this.el[ 0 ] ); + this.end = getElementStyles( this.el[ 0 ] ); this.diff = styleDifference( this.start, this.end ); return this; }); @@ -1045,7 +1039,7 @@ $.extend( $.effects, { // return an effect options object for the given parameters: function _normalizeArguments( effect, options, speed, callback ) { - // allow passing all optinos as the first parameter + // allow passing all options as the first parameter if ( $.isPlainObject( effect ) ) { options = effect; effect = effect.effect; @@ -1054,8 +1048,8 @@ function _normalizeArguments( effect, options, speed, callback ) { // convert to an object effect = { effect: effect }; - // catch (effect) - if ( options === undefined ) { + // catch (effect, null, ...) + if ( options == null ) { options = {}; } @@ -1102,28 +1096,17 @@ function standardSpeed( speed ) { } // invalid strings - treat as "normal" speed - if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { - // TODO: remove in 2.0 (#7115) - if ( backCompat && $.effects[ speed ] ) { - return false; - } - return true; - } - - return false; + return typeof speed === "string" && !$.effects.effect[ speed ]; } $.fn.extend({ - effect: function( effect, options, speed, callback ) { + effect: function( /* effect, options, speed, callback */ ) { var args = _normalizeArguments.apply( this, arguments ), mode = args.mode, queue = args.queue, - effectMethod = $.effects.effect[ args.effect ], + effectMethod = $.effects.effect[ args.effect ]; - // DEPRECATED: remove in 2.0 (#7115) - oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ]; - - if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) { + if ( $.fx.off || !effectMethod ) { // delegate to the original method (e.g., .show()) if possible if ( mode ) { return this[ mode ]( args.duration, args.complete ); @@ -1159,18 +1142,7 @@ $.fn.extend({ } } - // TODO: remove this check in 2.0, effectMethod will always be true - if ( effectMethod ) { - return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); - } else { - // DEPRECATED: remove in 2.0 (#7115) - return oldEffectMethod.call(this, { - options: args, - duration: args.duration, - callback: args.complete, - mode: args.mode - }); - } + return queue === false ? this.each( run ) : this.queue( queue || "fx", run ); }, _show: $.fn.show, |