From d0ca62826a84879790c11cecfbdaf5b3b005b217 Mon Sep 17 00:00:00 2001 From: vieron Date: Fri, 25 Oct 2013 21:16:41 +0200 Subject: [PATCH] chore(draggable): jQuery adapter returns Draggable instance Draggable instance instead of a jQuery collection. Why? Becomes a mess if Draggable is instantiated multiple times from the same HTML element. BREAKING CHANGES: If you was accessing to Draggable instances through .data('drag') you should remove the `data` getter. Since now the instance is returned directly. --- src/jquery.draggable.js | 6 +----- src/jquery.gridster.js | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/jquery.draggable.js b/src/jquery.draggable.js index 7f05e3aad..ccbee1934 100644 --- a/src/jquery.draggable.js +++ b/src/jquery.draggable.js @@ -358,11 +358,7 @@ //jQuery adapter $.fn.drag = function ( options ) { - return this.each(function () { - if (!$.data(this, 'drag')) { - $.data(this, 'drag', new Draggable( this, options )); - } - }); + return new Draggable(this, options); }; diff --git a/src/jquery.gridster.js b/src/jquery.gridster.js index 0e23d08be..e47715fac 100644 --- a/src/jquery.gridster.js +++ b/src/jquery.gridster.js @@ -682,7 +682,7 @@ }, 60) }); - this.drag_api = this.$el.drag(draggable_options).data('drag'); + this.drag_api = this.$el.drag(draggable_options); return this; };