From: Mike Sherov Date: Tue, 16 Oct 2012 04:15:22 +0000 (-0400) Subject: fix effects tests failure X-Git-Tag: 1.9.0b1~207 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d70e64bff2660cf5a801fe818f1170d5ea93e4fe;p=jquery.git fix effects tests failure --- diff --git a/src/css.js b/src/css.js index 99d578873..6f5456315 100644 --- a/src/css.js +++ b/src/css.js @@ -116,10 +116,6 @@ jQuery.fn.extend({ toggle: function( state, fn2 ) { var bool = typeof state === "boolean"; - if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { - return eventsToggle.apply( this, arguments ); - } - return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); diff --git a/src/deprecated.js b/src/deprecated.js index c5fa375d4..241eb2a81 100644 --- a/src/deprecated.js +++ b/src/deprecated.js @@ -60,7 +60,13 @@ jQuery.sub = function() { return jQuerySub; }; -jQuery.fn.toggle = function( fn ) { +var oldToggle = jQuery.fn.toggle; +jQuery.fn.toggle = function( fn, fn2 ) { + + if ( !jQuery.isFunction( fn ) || !jQuery.isFunction( fn2 ) ) { + return oldToggle.apply( this, arguments ); + } + // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, diff --git a/src/effects.js b/src/effects.js index 3118da407..9965eee78 100644 --- a/src/effects.js +++ b/src/effects.js @@ -445,9 +445,7 @@ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" || - // special check for .toggle( handler, handler, ... ) - ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? + return speed == null || typeof speed === "boolean" ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); };