Skip to content

Commit ba6916f

Browse files
IanSimpsonscottgonzalez
authored andcommitted
Sortable: Added a variable to track if initialization is complete. Fixes #4759 - a major optimization is possible in sortable().
1 parent 956c2cd commit ba6916f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ui/jquery.ui.sortable.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
$.widget("ui.sortable", $.ui.mouse, {
1818
version: "@VERSION",
1919
widgetEventPrefix: "sort",
20+
ready: false,
2021
options: {
2122
appendTo: "parent",
2223
axis: false,
@@ -58,6 +59,9 @@ $.widget("ui.sortable", $.ui.mouse, {
5859

5960
//Initialize mouse events for interaction
6061
this._mouseInit();
62+
63+
//We're ready to go
64+
this.ready = true
6165

6266
},
6367

@@ -571,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
571575
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
572576
var connectWith = this._connectWith();
573577

574-
if(connectWith) {
578+
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
575579
for (var i = connectWith.length - 1; i >= 0; i--){
576580
var cur = $(connectWith[i]);
577581
for (var j = cur.length - 1; j >= 0; j--){

0 commit comments

Comments
 (0)