Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
89dc1e01
Commit
89dc1e01
authored
Jul 13, 2009
by
Yehuda Katz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clearQueue and next should now work with default fx on all browsers
parent
7cfec998
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
28 deletions
+11
-28
data.js
src/data.js
+4
-4
data.js
test/unit/data.js
+7
-24
No files found.
src/data.js
View file @
89dc1e01
...
@@ -130,11 +130,11 @@ jQuery.fn.extend({
...
@@ -130,11 +130,11 @@ jQuery.fn.extend({
if
(
data
===
undefined
)
if
(
data
===
undefined
)
return
jQuery
.
queue
(
this
[
0
],
type
);
return
jQuery
.
queue
(
this
[
0
],
type
);
return
this
.
each
(
function
(){
return
this
.
each
(
function
(
i
,
elem
){
var
queue
=
jQuery
.
queue
(
this
,
type
,
data
);
var
queue
=
jQuery
.
queue
(
this
,
type
,
data
);
if
(
type
==
"fx"
&&
queue
.
length
==
1
)
if
(
type
==
"fx"
&&
queue
.
length
==
1
)
queue
[
0
].
call
(
this
);
queue
[
0
].
call
(
this
,
function
()
{
jQuery
(
elem
).
dequeue
(
type
);
}
);
});
});
},
},
dequeue
:
function
(
type
){
dequeue
:
function
(
type
){
...
@@ -143,6 +143,6 @@ jQuery.fn.extend({
...
@@ -143,6 +143,6 @@ jQuery.fn.extend({
});
});
},
},
clearQueue
:
function
(
type
){
clearQueue
:
function
(
type
){
return
this
.
queue
(
type
,
[]
);
return
this
.
queue
(
type
||
"fx"
,
[]
);
}
}
});
});
\ No newline at end of file
test/unit/data.js
View file @
89dc1e01
...
@@ -180,22 +180,6 @@ test("queue(name) passes in the next item in the queue as a parameter", function
...
@@ -180,22 +180,6 @@ test("queue(name) passes in the next item in the queue as a parameter", function
div
.
removeData
();
div
.
removeData
();
});
});
expect
(
1
);
var
div
=
jQuery
({});
var
counter
=
0
;
div
.
queue
(
"foo"
,
function
(
next
)
{
counter
++
;
jQuery
(
this
).
clearQueue
(
"foo"
);
next
();
}).
queue
(
"foo"
,
function
(
next
)
{
counter
++
;
});
div
.
dequeue
(
"foo"
);
equals
(
counter
,
1
,
"the queue was cleared"
);
test
(
"queue(name) passes in the next item in the queue as a parameter"
,
function
()
{
test
(
"queue(name) passes in the next item in the queue as a parameter"
,
function
()
{
expect
(
2
);
expect
(
2
);
...
@@ -229,12 +213,10 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
...
@@ -229,12 +213,10 @@ test("queue() passes in the next item in the queue as a parameter to fx queues",
}).
queue
(
function
(
next
)
{
}).
queue
(
function
(
next
)
{
equals
(
++
counter
,
2
,
"Next was called"
);
equals
(
++
counter
,
2
,
"Next was called"
);
next
();
next
();
}).
queue
(
function
()
{
}).
queue
(
"bar"
,
function
()
{
equals
(
++
counter
,
3
,
"Other queues are not triggered by next()"
)
equals
(
++
counter
,
3
,
"Other queues are not triggered by next()"
)
});
});
div
.
dequeue
();
div
.
removeData
();
div
.
removeData
();
});
});
...
@@ -255,6 +237,8 @@ test("clearQueue(name) clears the queue", function() {
...
@@ -255,6 +237,8 @@ test("clearQueue(name) clears the queue", function() {
div
.
dequeue
(
"foo"
);
div
.
dequeue
(
"foo"
);
equals
(
counter
,
1
,
"the queue was cleared"
);
equals
(
counter
,
1
,
"the queue was cleared"
);
div
.
removeData
();
});
});
test
(
"clearQueue() clears the fx queue"
,
function
()
{
test
(
"clearQueue() clears the fx queue"
,
function
()
{
...
@@ -265,13 +249,12 @@ test("clearQueue() clears the fx queue", function() {
...
@@ -265,13 +249,12 @@ test("clearQueue() clears the fx queue", function() {
div
.
queue
(
function
(
next
)
{
div
.
queue
(
function
(
next
)
{
counter
++
;
counter
++
;
jQuery
(
this
).
clearQueue
();
setTimeout
(
function
()
{
jQuery
(
this
).
clearQueue
();
next
();
},
50
);
next
();
}).
queue
(
function
(
next
)
{
}).
queue
(
function
(
next
)
{
counter
++
;
counter
++
;
});
});
div
.
dequeue
();
equals
(
counter
,
1
,
"the queue was cleared"
);
equals
(
counter
,
1
,
"the queue was cleared"
);
})
div
.
removeData
();
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment