]> source.dussan.org Git - jquery-ui.git/commitdiff
Effects: Fixed a bug when animating classes and nothing should happen, e.g., calling...
authorScott González <scott.gonzalez@gmail.com>
Fri, 6 Nov 2009 14:15:53 +0000 (14:15 +0000)
committerScott González <scott.gonzalez@gmail.com>
Fri, 6 Nov 2009 14:15:53 +0000 (14:15 +0000)
ui/jquery.effects.core.js

index 3c777db39dfb06bfde7af2cb18b87e8e837fe641..71a959c34ff0b2cc0666864261923546b737d901 100644 (file)
@@ -103,22 +103,19 @@ $.effects = {
                        var that = $(this),
                                originalStyleAttr = that.attr('style') || ' ',
                                originalStyle = filterStyles(getElementStyles.call(this)),
-                               newStyle;
+                               newStyle,
+                               className = that.attr('className');
 
-                       $.each(classAnimationActions, function(action) {
+                       $.each(classAnimationActions, function(i, action) {
                                if (value[action]) {
                                        that[action + 'Class'](value[action]);
                                }
                        });
                        newStyle = filterStyles(getElementStyles.call(this));
-                       $.each(classAnimationActions, function(action, reverse) {
-                               if (value[action]) {
-                                       that[reverse + 'Class'](value[action]);
-                               }
-                       });
+                       that.attr('className', className);
 
                        that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
-                               $.each(classAnimationActions, function(action) {
+                               $.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
@@ -136,11 +133,7 @@ $.effects = {
 
 // start class animations
 
-var classAnimationActions = {
-       add: 'remove',
-       remove: 'add',
-       toggle: 'toggle'
-};
+var classAnimationActions = ['add', 'remove', 'toggle'];
 
 function getElementStyles() {
        var style = document.defaultView