mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Sortable: Don't create functions inside loops.
This commit is contained in:
parent
71a332e8b8
commit
7033544cdd
20
ui/jquery.ui.sortable.js
vendored
20
ui/jquery.ui.sortable.js
vendored
@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
(function( $, undefined ) {
|
(function( $, undefined ) {
|
||||||
|
|
||||||
/*jshint loopfunc: true */
|
|
||||||
|
|
||||||
function isOverAxis( x, reference, size ) {
|
function isOverAxis( x, reference, size ) {
|
||||||
return ( x > reference ) && ( x < ( reference + size ) );
|
return ( x > reference ) && ( x < ( reference + size ) );
|
||||||
}
|
}
|
||||||
@ -629,10 +627,11 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
|
|
||||||
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
|
queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]);
|
||||||
|
|
||||||
|
function addItems() {
|
||||||
|
items.push( this );
|
||||||
|
}
|
||||||
for (i = queries.length - 1; i >= 0; i--){
|
for (i = queries.length - 1; i >= 0; i--){
|
||||||
queries[i][0].each(function() {
|
queries[i][0].each( addItems );
|
||||||
items.push(this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $(items);
|
return $(items);
|
||||||
@ -1190,12 +1189,17 @@ $.widget("ui.sortable", $.ui.mouse, {
|
|||||||
|
|
||||||
|
|
||||||
//Post events to containers
|
//Post events to containers
|
||||||
|
function delayEvent( type, instance, container ) {
|
||||||
|
return function( event ) {
|
||||||
|
container._trigger( type, event, instance._uiHash( instance ) );
|
||||||
|
};
|
||||||
|
}
|
||||||
for (i = this.containers.length - 1; i >= 0; i--){
|
for (i = this.containers.length - 1; i >= 0; i--){
|
||||||
if(!noPropagation) {
|
if (!noPropagation) {
|
||||||
delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) );
|
||||||
}
|
}
|
||||||
if(this.containers[i].containerCache.over) {
|
if(this.containers[i].containerCache.over) {
|
||||||
delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
|
delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) );
|
||||||
this.containers[i].containerCache.over = 0;
|
this.containers[i].containerCache.over = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user