Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sortable: Fixed container change detection. Fixes #5159 - Remove and …
…receive events on nested sortables.

(cherry picked from commit b9ef00f)

Conflicts:

	ui/jquery.ui.sortable.js
  • Loading branch information
Martin Hoch authored and scottgonzalez committed Aug 23, 2012
1 parent a4ae382 commit c0d0283
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ui/jquery.ui.sortable.js
Expand Up @@ -1012,15 +1012,16 @@ $.widget("ui.sortable", $.ui.mouse, {

if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
for (var i = this.containers.length - 1; i >= 0; i--){
if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) {
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i]));
}
};
};

// Check if the items Container has Changed and trigger appropriate
// events.
if (this !== this.currentContainer) {
if(!noPropagation) {
delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.currentContainer));
}
}

//Post events to containers
for (var i = this.containers.length - 1; i >= 0; i--){
Expand Down

0 comments on commit c0d0283

Please sign in to comment.