Bug Tracker

Opened 15 years ago

Closed 15 years ago

#1514 closed bug (invalid)

animate() has 4 params but why is it being called with only 3 in wrong order

Reported by: RghSx Owned by:
Priority: critical Milestone: 1.1.4
Component: core Version: 1.1.3
Keywords: animate slideUp slideDown Cc: [email protected]
Blocked by: Blocking:

Description

In 1.1.3.1 version, the animate function I see now takes 4 params - why are the utility functions (slideUp,slideDown,slideToggle,fadeIn,fadeOut,fadeTo) seeming to pass only 3 and in the wrong order? Is this an oversight?

animate: function( prop, speed, easing, callback ) animate function declaration

	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, callback);
	},
	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, callback);
	},
	slideToggle: function(speed, callback){
		return this.animate({height: "toggle"}, speed, callback);
	},
	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, callback);
	},
	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, callback);
	},
	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, callback);
	},

I've put a temporary fix to this by inserting the string 'linear' as the 3rd argument.

	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, ''''linear'''', callback);
	},
	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, ''''linear'''', callback);
	},
	slideToggle: function(speed, callback){
		return this.animate({height: "toggle"}, speed, ''''linear'''', callback);
	},
	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, ''''linear'''', callback);
	},
	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, ''''linear'''', callback);
	},
	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, ''''linear'''', callback);
	},

Change History (3)

comment:1 Changed 15 years ago by john

Resolution: invalid
Status: newclosed

No, this is correct. The easing argument is optional - so those calls are perfectly ok. (The .animate() function has taken 4 arguments since jQuery 1.1).

comment:2 Changed 15 years ago by RghSx

Resolution: invalid
Status: closedreopened

I'm sorry but maybe you can explain it to me better, the easing may be an optional param, how can you pass a callback reference as the 3rd param to the animate() function when it's expected to be the 4th argument in the animate(arg1,arg2,arg3,callback)?

Isn't the order important?

comment:3 Changed 15 years ago by john

Resolution: invalid
Status: reopenedclosed

The only important aspect is that the callback is the last argument - checks are made in the animate functions (specifically inside the jQuery.speed() function) and the order of the arguments is set. In the future, you could bring up issues like this on the jQuery Dev mailing list: http://docs.jquery.com/Discussion

Note: See TracTickets for help on using tickets.