Skip to content
Permalink
Browse files

Effects: 1.8 Animation Rewrite - thanks @mikesherov and @gibson042

  • Loading branch information
gnarf authored and dmethvin committed Apr 23, 2012
1 parent 8ad22a2 commit 58ed62ed12cb48d9224f699e86e197804ca5ece4
Showing with 618 additions and 546 deletions.
  1. +16 −8 src/css.js
  2. +537 −534 src/effects.js
  3. +3 −3 test/unit/css.js
  4. +62 −1 test/unit/effects.js
@@ -1,18 +1,20 @@
(function( jQuery ) {

jQuery.cssExpand = [ "Top", "Right", "Bottom", "Left" ];

var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
rnumsplit = /^([\-+]?(?:\d*\.)?\d+)(.*)$/i,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
rrelNum = /^([\-+])=([\-+.\de]+)/,
rmargin = /^margin/,

cssShow = { position: "absolute", visibility: "hidden", display: "block" },

// order is important!
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssExpand = jQuery.cssExpand,
cssPrefixes = [ "O", "Webkit", "Moz", "ms" ],

curCSS;
@@ -264,6 +266,13 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {
};
}

function setPositiveNumber( elem, value ) {
var matches = rnumsplit.exec( value );
return matches ?
Math.max( 0, matches[ 1 ] ) + ( matches [ 2 ] || "px" )
: value;
}

function getWidthOrHeight( elem, name, extra ) {

// Start with offset property, which is equivalent to the border-box value
@@ -348,11 +357,7 @@ jQuery.each([ "height", "width" ], function( i, name ) {
}
},

set: function( elem, value ) {
return rnum.test( value ) ?
value + "px" :
value;
}
set: setPositiveNumber
};
});

@@ -436,7 +441,6 @@ jQuery.each({
padding: "",
border: "Width"
}, function( prefix, suffix ) {

jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
@@ -453,6 +457,10 @@ jQuery.each({
return expanded;
}
};

if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});

})( jQuery );

5 comments on commit 58ed62e

@Krinkle

This comment has been minimized.

Copy link
Member

@Krinkle Krinkle replied Apr 25, 2012

This commit introduced 12 failures in the dimensions test suite in (all browsers).

@rwaldron

This comment has been minimized.

Copy link
Member

@rwaldron rwaldron replied Apr 25, 2012

Are those timeouts?

@Krinkle

This comment has been minimized.

Copy link
Member

@Krinkle Krinkle replied Apr 25, 2012

No, they are not. I linked to the run results and job page above. The failures are assertions, such as "Test negative width ignored (Expected: 30; Result: 0)".

@rwaldron

This comment has been minimized.

Copy link
Member

@rwaldron rwaldron replied Apr 25, 2012

I didn't have time to look at it 5 minutes ago, so I was being lazy.

@gnarf

This comment has been minimized.

Copy link
Member Author

@gnarf gnarf replied Apr 25, 2012

Hrm, I'll dig into it tonight unless @mikesherov beats me to it.

Please sign in to comment.
You can’t perform that action at this time.