mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
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.
This commit is contained in:
parent
ad2e514b07
commit
b0733bbe59
19
ui/jquery.effects.core.js
vendored
19
ui/jquery.effects.core.js
vendored
@ -103,22 +103,19 @@ $.effects = {
|
|||||||
var that = $(this),
|
var that = $(this),
|
||||||
originalStyleAttr = that.attr('style') || ' ',
|
originalStyleAttr = that.attr('style') || ' ',
|
||||||
originalStyle = filterStyles(getElementStyles.call(this)),
|
originalStyle = filterStyles(getElementStyles.call(this)),
|
||||||
newStyle;
|
newStyle,
|
||||||
|
className = that.attr('className');
|
||||||
|
|
||||||
$.each(classAnimationActions, function(action) {
|
$.each(classAnimationActions, function(i, action) {
|
||||||
if (value[action]) {
|
if (value[action]) {
|
||||||
that[action + 'Class'](value[action]);
|
that[action + 'Class'](value[action]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
newStyle = filterStyles(getElementStyles.call(this));
|
newStyle = filterStyles(getElementStyles.call(this));
|
||||||
$.each(classAnimationActions, function(action, reverse) {
|
that.attr('className', className);
|
||||||
if (value[action]) {
|
|
||||||
that[reverse + 'Class'](value[action]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
|
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]); }
|
if (value[action]) { that[action + 'Class'](value[action]); }
|
||||||
});
|
});
|
||||||
// work around bug in IE by clearing the cssText before setting it
|
// work around bug in IE by clearing the cssText before setting it
|
||||||
@ -136,11 +133,7 @@ $.effects = {
|
|||||||
|
|
||||||
// start class animations
|
// start class animations
|
||||||
|
|
||||||
var classAnimationActions = {
|
var classAnimationActions = ['add', 'remove', 'toggle'];
|
||||||
add: 'remove',
|
|
||||||
remove: 'add',
|
|
||||||
toggle: 'toggle'
|
|
||||||
};
|
|
||||||
|
|
||||||
function getElementStyles() {
|
function getElementStyles() {
|
||||||
var style = document.defaultView
|
var style = document.defaultView
|
||||||
|
Loading…
Reference in New Issue
Block a user