Draggable: Added exclude option without backCompat

This commit is contained in:
Dave Stein 2012-12-10 17:10:45 -05:00
parent 0e65dec8c4
commit 25cf569c63

View File

@ -32,7 +32,8 @@ $.widget( "ui.draggable", $.ui.interaction, {
options: { options: {
appendTo: null, appendTo: null,
handle: null, handle: null,
helper: false helper: false,
exclude: "input,textarea,button,select,option"
}, },
// dragEl: element being dragged (original or helper) // dragEl: element being dragged (original or helper)
@ -63,7 +64,11 @@ $.widget( "ui.draggable", $.ui.interaction, {
/** interaction interface **/ /** interaction interface **/
_isValidTarget: function( element ) { _isValidTarget: function( element ) {
return this.options.handle ? element.is( this.options.handle ) : true;
var handle = this.options.handle ? element.is( this.options.handle ) : true,
exclude = this.options.exclude ? element.is( this.options.exclude ) : false;
return ( handle && !exclude );
}, },
_start: function( event, pointerPosition ) { _start: function( event, pointerPosition ) {