r1576 - trunk/ui
r1576 - trunk/ui
Author: paul.bakaus
Date: Fri Jan 9 07:16:41 2009
New Revision: 1576
Modified:
trunk/ui/ui.sortable.js
Log:
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
Modified: trunk/ui/ui.sortable.js
==============================================================================
--- trunk/ui/ui.sortable.js (original)
+++ trunk/ui/ui.sortable.js Fri Jan 9 07:16:41 2009
@@ -556,19 +556,18 @@
.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 @@
_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: {},