Bug Tracker

Modify

Ticket #5557 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by john

  • Status changed from new to closed
  • Version set to 1.4a1
  • Resolution set to fixed

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.