mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Followup to #11469; add test case and clarify code.
This commit is contained in:
parent
d5ee856a44
commit
fdf37de778
5
src/effects.js
vendored
5
src/effects.js
vendored
@ -4,6 +4,7 @@ var elemdisplay = {},
|
|||||||
iframe, iframeDoc,
|
iframe, iframeDoc,
|
||||||
rfxtypes = /^(?:toggle|show|hide)$/,
|
rfxtypes = /^(?:toggle|show|hide)$/,
|
||||||
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
|
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
|
||||||
|
rMarginProp = /^margin/,
|
||||||
timerId,
|
timerId,
|
||||||
fxAttrs = [
|
fxAttrs = [
|
||||||
// height animations
|
// height animations
|
||||||
@ -636,8 +637,8 @@ jQuery.extend( jQuery.fx, {
|
|||||||
|
|
||||||
// Ensure props that can't be negative don't go there on undershoot easing
|
// Ensure props that can't be negative don't go there on undershoot easing
|
||||||
jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
|
jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
|
||||||
// exclude marginTop, marginLeft, marginBottom and marginRight from this list
|
// Exclude marginTop, marginLeft, marginBottom and marginRight from this list
|
||||||
if ( prop.indexOf( "margin" ) ) {
|
if ( !rMarginProp.test( prop ) ) {
|
||||||
jQuery.fx.step[ prop ] = function( fx ) {
|
jQuery.fx.step[ prop ] = function( fx ) {
|
||||||
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
|
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
|
||||||
};
|
};
|
||||||
|
9
test/unit/effects.js
vendored
9
test/unit/effects.js
vendored
@ -263,6 +263,15 @@ test("animate negative height", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("animate negative margin", function() {
|
||||||
|
expect(1);
|
||||||
|
stop();
|
||||||
|
jQuery("#foo").animate({ marginTop: -100 }, 100, function() {
|
||||||
|
equal( jQuery(this).css("marginTop"), "-100px", "Verify margin." );
|
||||||
|
start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("animate negative padding", function() {
|
test("animate negative padding", function() {
|
||||||
expect(1);
|
expect(1);
|
||||||
stop();
|
stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user