Skip to content

Commit 5439940

Browse files
committed
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.
1 parent df7e300 commit 5439940

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

ui/jquery.effects.core.js

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

234-
return this.queue('fx', function() {
234+
return this.queue(function() {
235235
var that = $(this),
236236
originalStyleAttr = that.attr('style') || ' ',
237237
originalStyle = filterStyles(getElementStyles.call(this)),
238238
newStyle,
239-
className = that.attr('className');
239+
className = that.attr('class');
240240

241241
$.each(classAnimationActions, function(i, action) {
242242
if (value[action]) {
243243
that[action + 'Class'](value[action]);
244244
}
245245
});
246246
newStyle = filterStyles(getElementStyles.call(this));
247-
that.attr('className', className);
248-
249-
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
250-
$.each(classAnimationActions, function(i, action) {
251-
if (value[action]) { that[action + 'Class'](value[action]); }
252-
});
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);
247+
that.attr('class', className);
248+
249+
that.animate(styleDifference(originalStyle, newStyle), {
250+
queue: false,
251+
duration: duration,
252+
easding: easing,
253+
complete: function() {
254+
$.each(classAnimationActions, function(i, action) {
255+
if (value[action]) { that[action + 'Class'](value[action]); }
256+
});
257+
// work around bug in IE by clearing the cssText before setting it
258+
if (typeof that.attr('style') == 'object') {
259+
that.attr('style').cssText = '';
260+
that.attr('style').cssText = originalStyleAttr;
261+
} else {
262+
that.attr('style', originalStyleAttr);
263+
}
264+
if (callback) { callback.apply(this, arguments); }
265+
$.dequeue( this );
259266
}
260-
if (callback) { callback.apply(this, arguments); }
261267
});
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);
269268
});
270269
};
271270

0 commit comments

Comments
 (0)