Bug Tracker

Opened 6 years ago

Closed 5 years ago

#14696 closed bug (invalid)

The stop method of jQuery 1.10.2 (1.7-1.10) will interrupt custom queue which is running delay element

Reported by: wangzhenhua1020@… Owned by: wangzhenhua1020@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

<html> <head></head> <script type="text/javascript" src="jquery-1.10.2.js"></script> <script type="text/javascript">

$(document).ready(function() {

var $a = $("#a"); $a.animate({left: 300}, 5000);

$a.delay(3000, "aa").queue("aa", function() {

alert("---");Can't be excuted, unless use $a.stop("fx") $(this).dequeue("aa");

}).dequeue("aa"); setTimeout(function() {

$a.stop();$a.stop("fx");

}, 2000);

});

</script> <body>

<div id="a" style="position:relative;width:50px;height:50px;background:red;"></div>

</body> </html>

Explanation:

The stop method of jQuery 1.10.2 will interrupt custom queue which is running delay element. First, If you change "$a.stop()" to "$a.stop ('fx')", then the custom queue "alert('---')" will be executed, but doing so requires passes a "fx" parameter when calling stop method, it seem redundant. Second, the arguments length in the stop method of jquery-1.7 before is two, not three as the lastest jquery, so pass "fx" parameter to stop method of jquery-1.6.4 or earlier versions is not allowed. so I believed that this phenomenon is the bug of jquery-1.10.2(Accurate to say, version 1.7 to 1.10).

As my bad English,The following provides Chinese Explanation.

说明:

当调用jQuery 1.10.2的stop方法时,若此时自定义队列的delay方法中的函数(它并不是一个动画)正在运行,则会被停止。 首先,上面的$a.stop()如果改为$a.stop("fx"),那么自定义队列的alert("---")就会执行,但这样做就需要在调用stop方法时多传递一个“fx”参数,显得多余;第二,在jquery1.7之前的版本stop方法的参数为2个,并非新版本的3个参数,所以在1.7之前的jquery中向stop方法传递“fx”参数是不允许的。所以怀疑这个现象是不是jquery-1.10.2(准确的说是1.7到1.10版本似乎都有这个问题)的bug。

Change History (3)

comment:1 Changed 6 years ago by anonymous

<html>
<head></head>
<script type="text/javascript" src="jquery-1.10.2.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var $a = $("#a");
		$a.animate({left: 300}, 5000);
 		$a.delay(3000, "aa").queue("aa", function() {
 			alert("---");//Can't be excuted, unless use $a.stop("fx")
 			$(this).dequeue("aa");
 		}).dequeue("aa");
 		setTimeout(function() {
 			$a.stop();//$a.stop("fx");
 		}, 2000);
 	});
</script>
<body>
	<div id="a" style="position:relative;width:50px;height:50px;background:red;"></div>
</body>
</html>

comment:2 Changed 5 years ago by timmywil

Owner: set to wangzhenhua1020@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the "jQuery(edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read:

Additional resources:

comment:3 Changed 5 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.