diff options
author | Felix Nagel <info@felixnagel.com> | 2011-05-23 22:10:58 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2011-05-23 22:10:58 +0200 |
commit | 6347f529e85aa1535bf8564f3ab6b7c39117c3f0 (patch) | |
tree | 2ac1dd3cc0916b54b6e94d267df1047593f726e8 /ui/jquery.ui.sortable.js | |
parent | d76aeef6de75896cfb147e3aa877a5e555273bc1 (diff) | |
parent | 23f222531d459e0fe38ddb4730ae060073d5d5c0 (diff) | |
download | jquery-ui-6347f529e85aa1535bf8564f3ab6b7c39117c3f0.tar.gz jquery-ui-6347f529e85aa1535bf8564f3ab6b7c39117c3f0.zip |
Merge commit '1.8.13' into selectmenu
Diffstat (limited to 'ui/jquery.ui.sortable.js')
-rw-r--r-- | ui/jquery.ui.sortable.js | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 6cc2434e8..91a42658f 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -1,7 +1,7 @@ /* * jQuery UI Sortable @VERSION * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * @@ -49,8 +49,8 @@ $.widget("ui.sortable", $.ui.mouse, { //Get the items this.refresh(); - //Let's determine if the items are floating - this.floating = this.items.length ? (/left|right/).test(this.items[0].item.css('float')) : false; + //Let's determine if the items are being displayed horizontally + this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false; //Let's determine the parent's offset this.offset = this.element.offset(); @@ -360,7 +360,7 @@ $.widget("ui.sortable", $.ui.mouse, { if(this.dragging) { - this._mouseUp(); + this._mouseUp({ target: null }); if(this.options.helper == "original") this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); @@ -378,21 +378,23 @@ $.widget("ui.sortable", $.ui.mouse, { } - //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! - if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); - if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - - $.extend(this, { - helper: null, - dragging: false, - reverting: false, - _noFinalSort: null - }); + if (this.placeholder) { + //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! + if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]); + if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove(); - if(this.domPosition.prev) { - $(this.domPosition.prev).after(this.currentItem); - } else { - $(this.domPosition.parent).prepend(this.currentItem); + $.extend(this, { + helper: null, + dragging: false, + reverting: false, + _noFinalSort: null + }); + + if(this.domPosition.prev) { + $(this.domPosition.prev).after(this.currentItem); + } else { + $(this.domPosition.parent).prepend(this.currentItem); + } } return this; @@ -613,6 +615,10 @@ $.widget("ui.sortable", $.ui.mouse, { for (var i = this.items.length - 1; i >= 0; i--){ var item = this.items[i]; + //We ignore calculating positions of all connected containers when we're not over them + if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0]) + continue; + var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item; if (!fast) { |