Skip to content

Commit cba92af

Browse files
committed
Effects: Fixed queueing of class animations. Fixes #6748 - animateClass broken in 1.8.7.
1 parent b475ae7 commit cba92af

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

ui/jquery.effects.core.js

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -231,43 +231,41 @@ $.effects.animateClass = function(value, duration, easing, callback) {
231231
easing = null;
232232
}
233233

234-
return this.each(function() {
235-
$.queue(this, 'fx', function() {
236-
var that = $(this),
237-
originalStyleAttr = that.attr('style') || ' ',
238-
originalStyle = filterStyles(getElementStyles.call(this)),
239-
newStyle,
240-
className = that.attr('className');
234+
return this.queue('fx', function() {
235+
var that = $(this),
236+
originalStyleAttr = that.attr('style') || ' ',
237+
originalStyle = filterStyles(getElementStyles.call(this)),
238+
newStyle,
239+
className = that.attr('className');
240+
241+
$.each(classAnimationActions, function(i, action) {
242+
if (value[action]) {
243+
that[action + 'Class'](value[action]);
244+
}
245+
});
246+
newStyle = filterStyles(getElementStyles.call(this));
247+
that.attr('className', className);
241248

249+
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
242250
$.each(classAnimationActions, function(i, action) {
243-
if (value[action]) {
244-
that[action + 'Class'](value[action]);
245-
}
251+
if (value[action]) { that[action + 'Class'](value[action]); }
246252
});
247-
newStyle = filterStyles(getElementStyles.call(this));
248-
that.attr('className', className);
249-
250-
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
251-
$.each(classAnimationActions, function(i, action) {
252-
if (value[action]) { that[action + 'Class'](value[action]); }
253-
});
254-
// work around bug in IE by clearing the cssText before setting it
255-
if (typeof that.attr('style') == 'object') {
256-
that.attr('style').cssText = '';
257-
that.attr('style').cssText = originalStyleAttr;
258-
} else {
259-
that.attr('style', originalStyleAttr);
260-
}
261-
if (callback) { callback.apply(this, arguments); }
262-
});
263-
264-
// $.animate adds a function to the end of the queue
265-
// but we want it at the front
266-
var queue = $.queue(this),
267-
anim = queue.splice(queue.length - 1, 1)[0];
268-
queue.splice(1, 0, anim);
269-
$.dequeue(this);
253+
// work around bug in IE by clearing the cssText before setting it
254+
if (typeof that.attr('style') == 'object') {
255+
that.attr('style').cssText = '';
256+
that.attr('style').cssText = originalStyleAttr;
257+
} else {
258+
that.attr('style', originalStyleAttr);
259+
}
260+
if (callback) { callback.apply(this, arguments); }
270261
});
262+
263+
// $.animate adds a function to the end of the queue
264+
// but we want it at the front
265+
var queue = $.queue(this),
266+
anim = queue.splice(queue.length - 1, 1)[0];
267+
queue.splice(1, 0, anim);
268+
$.dequeue(this);
271269
});
272270
};
273271

0 commit comments

Comments
 (0)