Draggable: Fixed overwriting _setOption to handle both backCompats rather than clobbering itself

This commit is contained in:
Dave Stein 2013-02-18 20:01:11 -05:00
parent e056860f5d
commit 47d2bb3094

View File

@ -608,27 +608,43 @@ if ( $.uiBackCompat !== false ) {
};
},
_setOption: function( key, value ) {
if ( key !== "helper" ) {
return this._super( key, value );
}
if ( value === "clone" ) {
value = true;
}
if ( value === "original" ) {
value = false;
}
this._super( key, value );
}
});
// Overwriting _setOption to handle multiple backCompats
$.widget( "ui.draggable", $.ui.draggable, {
_setOption: function( key, value ) {
if ( key !== "helper" && key !== "cancel" ) {
return this._super( key, value );
}
// If part of helper backcompat
if ( key === "helper" ) {
if ( value === "clone" ) {
value = true;
}
if ( value === "original" ) {
value = false;
}
this._super( key, value );
} else {
// If part of cancel backcompat
this._super( key, value );
this.options.exclude = this.options.cancel;
}
}
});
// axis option
$.widget( "ui.draggable", $.ui.draggable, {
@ -673,17 +689,6 @@ if ( $.uiBackCompat !== false ) {
this.options.exclude = this.options.cancel;
}
},
_setOption: function( key, value ) {
if ( key !== "cancel" ) {
return this._super( key, value );
}
this._super( key, value );
this.options.exclude = this.options.cancel;
}
});