diff options
author | Scott González <scott.gonzalez@gmail.com> | 2009-11-06 14:15:53 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2009-11-06 14:15:53 +0000 |
commit | b0733bbe59c17e49dcc8ee6dc98efe15c0c4ca8e (patch) | |
tree | 4ec85c5fe5e1de393df98119517322377212fde6 /ui/jquery.effects.core.js | |
parent | ad2e514b07943547d351fd4684dc949125569753 (diff) | |
download | jquery-ui-b0733bbe59c17e49dcc8ee6dc98efe15c0c4ca8e.tar.gz jquery-ui-b0733bbe59c17e49dcc8ee6dc98efe15c0c4ca8e.zip |
Effects: Fixed a bug when animating classes and nothing should happen, e.g., calling .removeClass('foo') when the element doesn't have the class foo.
Diffstat (limited to 'ui/jquery.effects.core.js')
-rw-r--r-- | ui/jquery.effects.core.js | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js index 3c777db39..71a959c34 100644 --- a/ui/jquery.effects.core.js +++ b/ui/jquery.effects.core.js @@ -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 |