Bug Tracker

Ticket #1514 (closed bug: invalid)

Opened 1 year ago

Last modified 1 year ago

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

Reported by: RghSx Assigned to: anonymous
Type: bug Priority: critical
Milestone: 1.1.4 Component: core
Version: 1.1.3 Keywords: animate slideUp slideDown
Cc: john.pangilinan@planetwidegames.com Needs: Review

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);
	},

Attachments

Change History

Changed 1 year ago by john

  • status changed from new to closed
  • resolution set to invalid

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).

Changed 1 year ago by RghSx

  • status changed from closed to reopened
  • resolution deleted

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?

Changed 1 year ago by john

  • status changed from reopened to closed
  • resolution set to invalid

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.