Bug Tracker

Opened 11 years ago

Closed 11 years ago

#5557 closed bug (fixed)

Speed function doesn't properly handle null values

Reported by: daltonlp Owned by:
Priority: major Milestone: 1.4
Component: effects Version: 1.4a1
Keywords: speed typeof null Cc:
Blocked by: Blocking:

Description

Line 4723 of the 9/25 nightly build does a typeof check against the "speed" parameter:

4722     speed: function(speed, easing, fn) {
4723         var opt = typeof speed === "object" ? speed : {
4724             complete: fn || !fn && easing ||
4725                 jQuery.isFunction( speed ) && speed,
4726             duration: speed,
4727             easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
4728         };  
4729             
4730         opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
4731             jQuery.fx.speeds[opt.duration] || jQuery.fx.speeds._default;

If the "speed" parameter is null, the typeof expression evaluates to "object", causing "opt" to be set to null. This triggers an error in line 4730 below.

My fix is to add a "speed &&" condition to line 4723:

var opt = speed && typeof speed === "object" ? speed : { 

Change History (1)

comment:1 Changed 11 years ago by john

Resolution: fixed
Status: newclosed
Version: 1.4a1
Note: See TracTickets for help on using tickets.