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
65df32dc
Commit
65df32dc
authored
Jan 16, 2013
by
Mike Sherov
Committed by
Dave Methvin
Jan 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #13183: Wrong animation initial value calc. Close gh-1136.
parent
79feac95
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
10 deletions
+27
-10
css.js
src/css.js
+1
-1
effects.js
src/effects.js
+2
-2
effects.js
test/unit/effects.js
+24
-7
No files found.
src/css.js
View file @
65df32dc
...
@@ -265,7 +265,7 @@ jQuery.extend({
...
@@ -265,7 +265,7 @@ jQuery.extend({
}
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if
(
extra
)
{
if
(
extra
===
""
||
extra
)
{
num
=
parseFloat
(
val
);
num
=
parseFloat
(
val
);
return
extra
===
true
||
jQuery
.
isNumeric
(
num
)
?
num
||
0
:
val
;
return
extra
===
true
||
jQuery
.
isNumeric
(
num
)
?
num
||
0
:
val
;
}
}
...
...
src/effects.js
View file @
65df32dc
...
@@ -427,11 +427,11 @@ Tween.propHooks = {
...
@@ -427,11 +427,11 @@ Tween.propHooks = {
return
tween
.
elem
[
tween
.
prop
];
return
tween
.
elem
[
tween
.
prop
];
}
}
// passing a
no
n empty string as a 3rd parameter to .css will automatically
// passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
// complex values such as "rotate(1rad)" are returned as is.
result
=
jQuery
.
css
(
tween
.
elem
,
tween
.
prop
,
"
auto
"
);
result
=
jQuery
.
css
(
tween
.
elem
,
tween
.
prop
,
""
);
// Empty strings, null, undefined and "auto" are converted to 0.
// Empty strings, null, undefined and "auto" are converted to 0.
return
!
result
||
result
===
"auto"
?
0
:
result
;
return
!
result
||
result
===
"auto"
?
0
:
result
;
},
},
...
...
test/unit/effects.js
View file @
65df32dc
...
@@ -283,14 +283,31 @@ test("animate native inline width/height", function() {
...
@@ -283,14 +283,31 @@ test("animate native inline width/height", function() {
}
}
});
});
test
(
"animate block width/height"
,
function
()
{
test
(
"animate block width/height"
,
function
()
{
expect
(
3
);
expect
(
3
);
stop
();
stop
();
jQuery
(
"#foo"
).
css
({
display
:
"block"
,
width
:
20
,
height
:
20
}).
animate
({
width
:
42
,
height
:
42
},
100
,
function
()
{
equal
(
jQuery
(
this
).
css
(
"display"
),
"block"
,
"inline-block was not set on block element when animating width/height"
);
jQuery
(
"<div>"
).
appendTo
(
"#qunit-fixture"
).
css
({
equal
(
this
.
offsetWidth
,
42
,
"width was animated"
);
display
:
"block"
,
equal
(
this
.
offsetHeight
,
42
,
"height was animated"
);
width
:
20
,
height
:
20
,
paddingLeft
:
60
}).
animate
({
width
:
42
,
height
:
42
},
{
duration
:
100
,
step
:
function
()
{
if
(
jQuery
(
this
).
width
()
>
42
)
{
ok
(
false
,
"width was incorrectly augmented during animation"
);
}
},
complete
:
function
()
{
equal
(
jQuery
(
this
).
css
(
"display"
),
"block"
,
"inline-block was not set on block element when animating width/height"
);
equal
(
jQuery
(
this
).
width
(),
42
,
"width was animated"
);
equal
(
jQuery
(
this
).
height
(),
42
,
"height was animated"
);
start
();
start
();
}
});
});
});
});
...
...
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