Skip to content

Commit b00faa9

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

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
@@ -16,6 +16,7 @@
1616

1717
$.widget("ui.sortable", $.ui.mouse, {
1818
widgetEventPrefix: "sort",
19+
ready: false,
1920
options: {
2021
appendTo: "parent",
2122
axis: false,
@@ -57,6 +58,9 @@ $.widget("ui.sortable", $.ui.mouse, {
5758

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

6165
},
6266

@@ -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)