aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Dovenmuehle <adovenmuehle@gmail.com>2010-11-19 08:54:11 -0500
committerScott González <scott.gonzalez@gmail.com>2010-11-19 08:54:11 -0500
commitabfa0e1e951b74548f9441a7ba44325d8c4d55b7 (patch)
treefc82a9332dfd179c1ba2a110d480eb24c6ff21ad
parenta2e0eb920aaa41e6248e1a2f7d013997ba4f421f (diff)
downloadjquery-ui-abfa0e1e951b74548f9441a7ba44325d8c4d55b7.tar.gz
jquery-ui-abfa0e1e951b74548f9441a7ba44325d8c4d55b7.zip
Core: Fixed switchClass queueing issues using lazy evaluation of element's style. Fixed #6244 - switchClass queues incorrectly.
-rw-r--r--ui/jquery.effects.core.js56
1 files changed, 32 insertions, 24 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js
index 111cb6f84..9be704128 100644
--- a/ui/jquery.effects.core.js
+++ b/ui/jquery.effects.core.js
@@ -232,33 +232,41 @@ $.effects.animateClass = function(value, duration, easing, callback) {
}
return this.each(function() {
+ $.queue(this, 'fx', function() {
+ var that = $(this),
+ originalStyleAttr = that.attr('style') || ' ',
+ originalStyle = filterStyles(getElementStyles.call(this)),
+ newStyle,
+ className = that.attr('className');
- var that = $(this),
- originalStyleAttr = that.attr('style') || ' ',
- originalStyle = filterStyles(getElementStyles.call(this)),
- newStyle,
- className = that.attr('className');
-
- $.each(classAnimationActions, function(i, action) {
- if (value[action]) {
- that[action + 'Class'](value[action]);
- }
- });
- 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]); }
+ 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); }
+ 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);
+ }
+ 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);
});
});
};