summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Hoch <martin@fidion.de>2012-08-22 22:04:40 -0400
committerScott González <scott.gonzalez@gmail.com>2012-08-22 22:07:10 -0400
commitc0d0283b3bab4fc211b086aa0fbeaa77aad0ce52 (patch)
treede8591cdb851e7c243fbf5c8df11b630dbe84146
parenta4ae3824893c085043122fd83d80723a08061ae2 (diff)
downloadjquery-ui-c0d0283b3bab4fc211b086aa0fbeaa77aad0ce52.tar.gz
jquery-ui-c0d0283b3bab4fc211b086aa0fbeaa77aad0ce52.zip
Sortable: Fixed container change detection. Fixes #5159 - Remove and receive events on nested sortables.
(cherry picked from commit b9ef00f0c7fe20980e3811e6622d8e2287e0fbf5) Conflicts: ui/jquery.ui.sortable.js
-rw-r--r--ui/jquery.ui.sortable.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 8f806c6cc..77842afce 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -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--){