Fixed an issue with animated .toggle() not working.
[jquery.git] / src / fx / fx.js
index 30bedbf..ece0cea 100644 (file)
@@ -112,11 +112,12 @@ jQuery.fn.extend({
         * @cat Effects
         */
        toggle: function( fn, fn2 ){
-               return fn ?
+               var args = arguments;
+               return fn && fn.constructor == Function && fn2 && fn2.constructor == Function ?
                        this._toggle( fn, fn2 ) :
                        this.each(function(){
                                jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]
-                                       .apply( jQuery(this), arguments );
+                                       .apply( jQuery(this), args );
                        });
        },
        
@@ -356,14 +357,14 @@ jQuery.fn.extend({
 jQuery.extend({
        
        speed: function(speed, easing, fn) {
-               var opt = speed.constructor == Object ? speed : {
+               var opt = speed && speed.constructor == Object ? speed : {
                        complete: fn || !fn && easing || 
-                               speed.constructor == Function && speed,
+                               speed && speed.constructor == Function && speed,
                        duration: speed,
                        easing: fn && easing || easing && easing.constructor != Function && easing
                };
 
-               opt.duration = (opt.duration.constructor == Number ? 
+               opt.duration = (opt.duration && opt.duration.constructor == Number ? 
                        opt.duration : 
                        { slow: 600, fast: 200 }[opt.duration]) || 400;