Skip to content

jQuery.stop: Unnecessary conditional statement #4374

Description

@wonseop

Description

I found strange code in line 545 of 'src/effect.js'.
The variable 'type' in this code can not be false.
Therefore, it would be better to modify the conditional statement.

	stop: function( type, clearQueue, gotoEnd ) {
		var stopQueue = function( hooks ) {
			var stop = hooks.stop;
			delete hooks.stop;
			stop( gotoEnd );
		};

		if ( typeof type !== "string" ) {    // <-- Valiable 'type' has a string value or 'undefined'
			gotoEnd = clearQueue;
			clearQueue = type;
			type = undefined;
		}
		if ( clearQueue && type !== false ) { // 'type !== false' is boolean check
                                                                           // It should be compared with 'string' type or 'undefined'
			this.queue( type || "fx", [] );
		}

Link to test case

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions