mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +00:00
Sortable: Added a variable to track if initialization is complete. Fixes #4759 - a major optimization is possible in sortable().
(cherry picked from commit ba6916f22a
)
This commit is contained in:
parent
9e4455f52d
commit
b00faa95d0
6
ui/jquery.ui.sortable.js
vendored
6
ui/jquery.ui.sortable.js
vendored
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
$.widget("ui.sortable", $.ui.mouse, {
|
$.widget("ui.sortable", $.ui.mouse, {
|
||||||
widgetEventPrefix: "sort",
|
widgetEventPrefix: "sort",
|
||||||
|
ready: false,
|
||||||
options: {
|
options: {
|
||||||
appendTo: "parent",
|
appendTo: "parent",
|
||||||
axis: false,
|
axis: false,
|
||||||
@ -58,6 +59,9 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
//Initialize mouse events for interaction
|
//Initialize mouse events for interaction
|
||||||
this._mouseInit();
|
this._mouseInit();
|
||||||
|
|
||||||
|
//We're ready to go
|
||||||
|
this.ready = true
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
@ -571,7 +575,7 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
|
var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
|
||||||
var connectWith = this._connectWith();
|
var connectWith = this._connectWith();
|
||||||
|
|
||||||
if(connectWith) {
|
if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
|
||||||
for (var i = connectWith.length - 1; i >= 0; i--){
|
for (var i = connectWith.length - 1; i >= 0; i--){
|
||||||
var cur = $(connectWith[i]);
|
var cur = $(connectWith[i]);
|
||||||
for (var j = cur.length - 1; j >= 0; j--){
|
for (var j = cur.length - 1; j >= 0; j--){
|
||||||
|
Loading…
Reference in New Issue
Block a user