r2454 - animateClass restores the original class-attribute, after calculating the animateStyles

r2454 - animateClass restores the original class-attribute, after calculating the animateStyles


Author: a.farkas.pm
Date: Wed Apr 15 04:02:19 2009
New Revision: 2454
Modified:
branches/dev/effects/ui/effects.core.js
Log:
animateClass restores the original class-attribute, after calculating the
animateStyles
Modified: branches/dev/effects/ui/effects.core.js
==============================================================================
--- branches/dev/effects/ui/effects.core.js    (original)
+++ branches/dev/effects/ui/effects.core.js    Wed Apr 15 04:02:19 2009
@@ -210,7 +210,7 @@
                    } else if(n == 'filter' &&
opts[i].newStyle[n].indexOf('opacity=') !== -1){ // handle filter opacity
                        opts[i].animateStyles.opacity =
parseInt(opts[i].newStyle[n].match(/opacity=([^)]*)/)[1], 10) / 100;
                    } else if (( !isNaN(parseInt(opts[i].newStyle[n], 10)) &&
opts[i].newStyle[n].match(/\s|,/) === null &&
-                        !isNaN(parseInt(oldStyle[i][n], 10)) && oldStyle[i][n].match(/\s|,/)
=== null) ||
+                        oldStyle[i][n].match(/\s|,/) === null) ||
                                    ($.fx.step[n] && !blacklistValues[opts[i].newStyle[n]])) /* Only
things that can be parsed to integers or we have a animate-Plugin for this
*/ {
                        opts[i].animateStyles[n] = opts[i].newStyle[n];
                    }
@@ -227,6 +227,7 @@
                    });
                }
            });
+            
            opts[i].animateStyles._pseudoAnimation = 1; //animation
queue-/deque-workaround (always animate something)
            
            //this will work, if Ticket 3981 is resolved in jQuery
@@ -238,26 +239,22 @@
    }
    
function createOptions(that, oldStyleAttr, childs){
- var options,
-            oldStyles,
-            elements = (childs[0]) ?
-            $($.merge(that.get(), childs.get())) :
-                that;
- //Let's get a style offset
- oldStyles = elements.map(getElementStyles);
-
+        var options,
+            className = that[0].className,
+            elements = (childs[0]) ?
+                $($.merge(that.get(), childs.get())) :
+                that,
+            oldStyles = elements.map(getElementStyles);
+
if (value.add)
that.addClass(value.add);
if (value.remove)
that.removeClass(value.remove);
        
-         options = filterStyles(elements.map(getElementOptions).get(),
oldStyles.get());
+        options = filterStyles(elements.map(getElementOptions).get(),
oldStyles.get());
        
- if (value.add)
- that.removeClass(value.add);
- if (value.remove)
- that.addClass(value.remove);
+ that[0].className = className;
        
return options;
}
@@ -273,8 +270,8 @@
        if (value.toggle) {
that.hasClass(value.toggle) ? value.remove = value.toggle :
value.add = value.toggle;
}
- //Let's get a style offset
        
+ //Let's get a style offset
var options = createOptions(that, oldStyleAttr, childs);
        
        var len = options.length,