Skip to main content

Bug Tracker

Side navigation

#5557 closed bug (fixed)

Opened November 26, 2009 10:47PM UTC

Closed December 05, 2009 07:34PM UTC

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 : { 
Attachments (0)
Change History (1)

Changed December 05, 2009 07:34PM UTC by john comment:1

resolution: → fixed
status: newclosed
version: → 1.4a1