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
25c188b6
Commit
25c188b6
authored
Nov 30, 2009
by
jeresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a problem with animations with a duration of 0 not working properly for hide and show.
parent
21dead46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
fx.js
src/fx.js
+4
-4
fx.js
test/unit/fx.js
+18
-13
No files found.
src/fx.js
View file @
25c188b6
...
...
@@ -18,8 +18,8 @@ function genFx( type, num ){
}
jQuery
.
fn
.
extend
({
show
:
function
(
speed
,
callback
)
{
if
(
speed
)
{
show
:
function
(
speed
,
callback
)
{
if
(
typeof
speed
!==
"undefined"
)
{
return
this
.
animate
(
genFx
(
"show"
,
3
),
speed
,
callback
);
}
else
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
...
...
@@ -58,8 +58,8 @@ jQuery.fn.extend({
}
},
hide
:
function
(
speed
,
callback
)
{
if
(
speed
)
{
hide
:
function
(
speed
,
callback
)
{
if
(
typeof
speed
!==
"undefined"
)
{
return
this
.
animate
(
genFx
(
"hide"
,
3
),
speed
,
callback
);
}
else
{
for
(
var
i
=
0
,
l
=
this
.
length
;
i
<
l
;
i
++
){
...
...
test/unit/fx.js
View file @
25c188b6
...
...
@@ -86,32 +86,37 @@ test("animate with no properties", function() {
});
test
(
"animate duration 0"
,
function
()
{
expect
(
7
);
expect
(
11
);
stop
();
var
$elems
=
jQuery
([{
a
:
0
},{
a
:
0
}]),
counter
=
0
,
count
=
function
(){
counter
++
;
};
var
$elems
=
jQuery
([{
a
:
0
},{
a
:
0
}]),
counter
=
0
;
equals
(
jQuery
.
timers
.
length
,
0
,
"Make sure no animation was running from another test"
);
$elems
.
eq
(
0
).
animate
(
{
a
:
1
},
0
,
count
);
$elems
.
eq
(
0
).
animate
(
{
a
:
1
},
0
,
function
(){
ok
(
true
,
"Animate a simple property."
);
counter
++
;
});
// Failed until [6115]
equals
(
jQuery
.
timers
.
length
,
0
,
"Make sure synchronic animations are not left on jQuery.timers"
);
equals
(
counter
,
1
,
"One synchronic animations"
);
$elems
.
animate
(
{
a
:
2
},
0
,
count
);
$elems
.
animate
(
{
a
:
2
},
0
,
function
(){
ok
(
true
,
"Animate a second simple property."
);
counter
++
;
});
equals
(
counter
,
3
,
"Multiple synchronic animations"
);
$elems
.
eq
(
0
).
animate
(
{
a
:
3
},
0
,
count
);
$elems
.
eq
(
1
).
animate
(
{
a
:
3
},
20
,
function
(){
count
();
$elems
.
eq
(
0
).
animate
(
{
a
:
3
},
0
,
function
(){
ok
(
true
,
"Animate a third simple property."
);
counter
++
;
});
$elems
.
eq
(
1
).
animate
(
{
a
:
3
},
200
,
function
(){
counter
++
;
// Failed until [6115]
equals
(
counter
,
5
,
"One synchronic and one asynchronic"
);
start
();
...
...
@@ -119,10 +124,10 @@ test("animate duration 0", function() {
var
$elem
=
jQuery
(
"<div />"
);
$elem
.
show
(
0
,
function
(){
ok
(
true
,
"Show
's
callback with no duration"
);
ok
(
true
,
"Show callback with no duration"
);
});
$elem
.
hide
(
0
,
function
(){
ok
(
true
,
"
Show's
callback with no duration"
);
ok
(
true
,
"
Hide
callback with no duration"
);
});
});
...
...
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