From 47d2bb30944b6a3c775605aecba6f9df32830249 Mon Sep 17 00:00:00 2001 From: Dave Stein Date: Mon, 18 Feb 2013 20:01:11 -0500 Subject: [PATCH] Draggable: Fixed overwriting _setOption to handle both backCompats rather than clobbering itself --- ui/jquery.ui.draggable.js | 63 +++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 38e141896..4914678ca 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -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; - } });