Skip to content

Commit 1cb5b87

Browse files
committed
Merge pull request jquery#3 from scottgonzalez/interactions
Draggable: Use ._bind().
2 parents 6ea6c47 + c4df289 commit 1cb5b87

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

ui/jquery.ui.draggable.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ $.widget( "ui.draggable", {
4545
this.element.css( "position", "relative" );
4646
}
4747

48-
// TODO: use _bind()
49-
this.element.bind( "mousedown." + this.widgetName, $.proxy( this, "_mouseDown" ) );
48+
this._bind({ mousedown: "_mouseDown" });
5049
},
5150

5251
// TODO: why is relative handled differently than fixed/absolute?
@@ -133,11 +132,10 @@ $.widget( "ui.draggable", {
133132
// TODO: allow modifying position, just like during drag
134133
this._trigger( "start", event, this._uiHash() );
135134

136-
// TODO: use ._bind()
137-
// TODO: rename _bind() to _on(); add _off()
138-
this.doc
139-
.bind( "mousemove." + this.widgetName, $.proxy( this, "_mouseMove" ) )
140-
.bind( "mouseup." + this.widgetName, $.proxy( this, "_mouseUp" ) );
135+
this._bind( this.doc, {
136+
mousemove: "_mouseMove",
137+
mouseup: "_mouseUp"
138+
});
141139
},
142140

143141
_mouseMove: function( event ) {
@@ -205,9 +203,7 @@ $.widget( "ui.draggable", {
205203
this.dragEl.remove();
206204
}
207205

208-
this.doc
209-
.unbind( "mousemove." + this.widgetName )
210-
.unbind( "mouseup." + this.widgetName );
206+
this.doc.unbind( "." + this.widgetName );
211207
},
212208

213209
_uiHash: function( event ) {

0 commit comments

Comments
 (0)