diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-09 15:16:41 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-09 15:16:41 +0000 |
commit | de1d540d94b6f1c839e7480f675afb411ffdc935 (patch) | |
tree | 81625aef086cee4ffcb153a8e3286550c44b1eea /ui/ui.sortable.js | |
parent | 142fddbf85a2903ec745afc4c5d7e85da3c9de7a (diff) | |
download | jquery-ui-de1d540d94b6f1c839e7480f675afb411ffdc935.tar.gz jquery-ui-de1d540d94b6f1c839e7480f675afb411ffdc935.zip |
sortable: don't copy content from the original item into the placeholder anymore by default (fixes #3595), check if event still exists in _trigger, fixes issue when you call $(this).sortable('cancel') from within a callback
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r-- | ui/ui.sortable.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 2c0d45250..174cde6b4 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -556,19 +556,18 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { .addClass(className || self.currentItem[0].className+" "+self.options.cssNamespace+"-sortable-placeholder") .removeClass(self.options.cssNamespace+'-sortable-helper')[0]; - if(!className) { + if(!className) el.style.visibility = "hidden"; - document.body.appendChild(el); - // Name attributes are removed, otherwice causes elements to be unchecked - // Expando attributes also have to be removed because of stupid IE (no condition, doesn't hurt in other browsers) - el.innerHTML = self.currentItem[0].innerHTML.replace(/name\=\"[^\"\']+\"/g, '').replace(/jQuery[0-9]+\=\"[^\"\']+\"/g, ''); - document.body.removeChild(el); - }; return el; }, update: function(container, p) { + + // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that + // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified if(className && !o.forcePlaceholderSize) return; + + //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); }; if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); }; } @@ -896,7 +895,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { _trigger: function(type, event, inst, noPropagation) { $.ui.plugin.call(this, type, [event, this._uiHash(inst)]); if(!noPropagation) $.widget.prototype._trigger.call(this, type, event, this._uiHash(inst)); - if(event.returnValue === false) this.cancel(); + if(event && event.returnValue === false) this.cancel(); }, plugins: {}, |