From c4df28939c8c2c0e94778333129b76e0bece35bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Fri, 14 Oct 2011 15:03:10 -0400 Subject: [PATCH] Draggable: Use ._bind(). --- ui/jquery.ui.draggable.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js index 1e9fb4cda..ef6af1086 100644 --- a/ui/jquery.ui.draggable.js +++ b/ui/jquery.ui.draggable.js @@ -45,8 +45,7 @@ $.widget( "ui.draggable", { this.element.css( "position", "relative" ); } - // TODO: use _bind() - this.element.bind( "mousedown." + this.widgetName, $.proxy( this, "_mouseDown" ) ); + this._bind({ mousedown: "_mouseDown" }); }, // TODO: why is relative handled differently than fixed/absolute? @@ -133,11 +132,10 @@ $.widget( "ui.draggable", { // TODO: allow modifying position, just like during drag this._trigger( "start", event, this._uiHash() ); - // TODO: use ._bind() - // TODO: rename _bind() to _on(); add _off() - this.doc - .bind( "mousemove." + this.widgetName, $.proxy( this, "_mouseMove" ) ) - .bind( "mouseup." + this.widgetName, $.proxy( this, "_mouseUp" ) ); + this._bind( this.doc, { + mousemove: "_mouseMove", + mouseup: "_mouseUp" + }); }, _mouseMove: function( event ) { @@ -205,9 +203,7 @@ $.widget( "ui.draggable", { this.dragEl.remove(); } - this.doc - .unbind( "mousemove." + this.widgetName ) - .unbind( "mouseup." + this.widgetName ); + this.doc.unbind( "." + this.widgetName ); }, _uiHash: function( event ) {