diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-04-27 10:49:08 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-04-27 10:49:08 -0400 |
commit | 54399403e76d4fbd17c8f2664e591fd89801fab1 (patch) | |
tree | 75823d1595d30fb8e80e3dbac7cc2b3319633efb /ui/jquery.effects.core.js | |
parent | df7e3000382e9c1e11659f5a65d43a93cc99c0e9 (diff) | |
download | jquery-ui-54399403e76d4fbd17c8f2664e591fd89801fab1.tar.gz jquery-ui-54399403e76d4fbd17c8f2664e591fd89801fab1.zip |
Class Animation: Use .attr( "class" ) instead of .attr( "className" ) and adjust the queueing logic for jQuery 1.6 compatibility. Fixes #7275 - $.effects.animateClass broken in jQuery 1.6.
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index a97ca040d..d9ff4b09b 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -231,12 +231,12 @@ $.effects.animateClass = function(value, duration, easing, callback) { easing = null; } - return this.queue('fx', function() { + return this.queue(function() { var that = $(this), originalStyleAttr = that.attr('style') || ' ', originalStyle = filterStyles(getElementStyles.call(this)), newStyle, - className = that.attr('className'); + className = that.attr('class'); $.each(classAnimationActions, function(i, action) { if (value[action]) { @@ -244,28 +244,27 @@ $.effects.animateClass = function(value, duration, easing, callback) { } }); newStyle = filterStyles(getElementStyles.call(this)); - that.attr('className', className); - - that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() { - $.each(classAnimationActions, function(i, action) { - if (value[action]) { that[action + 'Class'](value[action]); } - }); - // work around bug in IE by clearing the cssText before setting it - if (typeof that.attr('style') == 'object') { - that.attr('style').cssText = ''; - that.attr('style').cssText = originalStyleAttr; - } else { - that.attr('style', originalStyleAttr); + that.attr('class', className); + + that.animate(styleDifference(originalStyle, newStyle), { + queue: false, + duration: duration, + easding: easing, + complete: function() { + $.each(classAnimationActions, function(i, action) { + if (value[action]) { that[action + 'Class'](value[action]); } + }); + // work around bug in IE by clearing the cssText before setting it + if (typeof that.attr('style') == 'object') { + that.attr('style').cssText = ''; + that.attr('style').cssText = originalStyleAttr; + } else { + that.attr('style', originalStyleAttr); + } + if (callback) { callback.apply(this, arguments); } + $.dequeue( this ); } - if (callback) { callback.apply(this, arguments); } }); - - // $.animate adds a function to the end of the queue - // but we want it at the front - var queue = $.queue(this), - anim = queue.splice(queue.length - 1, 1)[0]; - queue.splice(1, 0, anim); - $.dequeue(this); }); }; |