From 885b90e753ed2bea49de8d62bf693d8b924e5f77 Mon Sep 17 00:00:00 2001
From: Matt Hoskins
Date: Wed, 31 Jul 2013 10:21:49 +0100
Subject: [PATCH 1/3] Sortable: Allow sortover to trigger even if current
container not changed. Fixes #9335 - sortover event does not consistently
fire.
---
ui/jquery.ui.sortable.js | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js
index 9c7bf446cda..0a24d8d238a 100644
--- a/ui/jquery.ui.sortable.js
+++ b/ui/jquery.ui.sortable.js
@@ -878,20 +878,21 @@ $.widget("ui.sortable", $.ui.mouse, {
return;
}
- if(this.currentContainer === this.containers[innermostIndex]) {
- return;
- }
-
- itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
- this._trigger("change", event, this._uiHash());
- this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
- this.currentContainer = this.containers[innermostIndex];
+ if(this.currentContainer !== this.containers[innermostIndex]) {
+ itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+ this._trigger("change", event, this._uiHash());
+ this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+ this.currentContainer = this.containers[innermostIndex];
- //Update the placeholder
- this.options.placeholder.update(this.currentContainer, this.placeholder);
+ //Update the placeholder
+ this.options.placeholder.update(this.currentContainer, this.placeholder);
+ }
+
- this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
- this.containers[innermostIndex].containerCache.over = 1;
+ if (!this.containers[innermostIndex].containerCache.over) {
+ this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+ this.containers[innermostIndex].containerCache.over = 1;
+ }
}
From 4e17aadaf9040fce084b57d07c7b574a80f96b4d Mon Sep 17 00:00:00 2001
From: Matt Hoskins
Date: Tue, 27 Aug 2013 10:03:38 +0100
Subject: [PATCH 2/3] Sortable Tests: Cover out event and out/over sequences
involving connected lists and draggable in tests (covering issue raised in
#9335).
---
tests/unit/sortable/sortable.html | 44 +++++
tests/unit/sortable/sortable_events.js | 173 ++++++++++++++++++-
tests/unit/sortable/sortable_test_helpers.js | 63 ++++++-
3 files changed, 276 insertions(+), 4 deletions(-)
diff --git a/tests/unit/sortable/sortable.html b/tests/unit/sortable/sortable.html
index 8e0bac501f4..87f86b7d1f6 100644
--- a/tests/unit/sortable/sortable.html
+++ b/tests/unit/sortable/sortable.html
@@ -16,6 +16,7 @@
"ui/jquery.ui.core.js",
"ui/jquery.ui.widget.js",
"ui/jquery.ui.mouse.js",
+ "ui/jquery.ui.draggable.js",
"ui/jquery.ui.sortable.js"
]
});
@@ -47,6 +48,25 @@
#sortable-table {
width: 100%;
}
+ ul.sortableoutover, ul.sortableoutoverdraggable {
+ position:relative;
+ top:0;
+ left:0;
+ }
+ ul.sortableoutover, ul.sortableoutover li, ul.sortableoutoverdraggable, ul.sortableoutoverdraggable li {
+ margin: 0;
+ padding: 0;
+ border-width: 0;
+ }
+ ul.sortableoutover li, ul.sortableoutoverdraggable li {
+ height: 20px;
+ }
+ #sortableoutoverspace {
+ height: 100px;
+ }
+ #sortableoutoverdraggablelist {
+ height: 20px;
+ }
@@ -94,6 +114,30 @@
+
+ - Item 1
+ - Item 2
+ - Item 3
+ - Item 4
+ - Item 5
+
+
+
+Space
+
+
+
+
+
+ - Item 1
+ - Item 2
+ - Item 3
+ - Item 4
+ - Item 5
+
+