fix effects tests failure

This commit is contained in:
Mike Sherov 2012-10-16 00:15:22 -04:00 committed by Dave Methvin
parent 6aae3e1038
commit d70e64bff2
3 changed files with 8 additions and 8 deletions

View File

@ -116,10 +116,6 @@ jQuery.fn.extend({
toggle: function( state, fn2 ) { toggle: function( state, fn2 ) {
var bool = typeof state === "boolean"; var bool = typeof state === "boolean";
if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
return eventsToggle.apply( this, arguments );
}
return this.each(function() { return this.each(function() {
if ( bool ? state : isHidden( this ) ) { if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show(); jQuery( this ).show();

View File

@ -60,7 +60,13 @@ jQuery.sub = function() {
return jQuerySub; 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 // Save reference to arguments for access in closure
var args = arguments, var args = arguments,
guid = fn.guid || jQuery.guid++, guid = fn.guid || jQuery.guid++,

4
src/effects.js vendored
View File

@ -445,9 +445,7 @@ Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ]; var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) { jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" || return speed == null || typeof speed === "boolean" ?
// special check for .toggle( handler, handler, ... )
( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
cssFn.apply( this, arguments ) : cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback ); this.animate( genFx( name, true ), speed, easing, callback );
}; };