diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-07 17:43:15 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2009-01-07 17:43:15 +0000 |
commit | ba757146216704c60feeda1dca5cfc08387b6ed3 (patch) | |
tree | 317ee4fdcc8e1332504875209ab43e022c67d38e /ui/ui.sortable.js | |
parent | 5eca84265fc8d7b5c7e5c9f508aded20109ebe32 (diff) | |
download | jquery-ui-ba757146216704c60feeda1dca5cfc08387b6ed3.tar.gz jquery-ui-ba757146216704c60feeda1dca5cfc08387b6ed3.zip |
draggable,droppable,sortable: properly implemented cssNamespace option across plugins (selectable & resizable to go, so those options should stay undocumented until all plugins are converted. Fixes #3707)
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r-- | ui/ui.sortable.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 39f1a8b34..58e36191c 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -17,7 +17,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { var o = this.options; this.containerCache = {}; - this.element.addClass("ui-sortable"); + (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-sortable")); //Get the items this.refresh(); @@ -35,7 +35,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { destroy: function() { this.element - .removeClass("ui-sortable ui-sortable-disabled") + .removeClass(this.options.cssNamespace+"-sortable "+this.options.cssNamespace+"-sortable-disabled") .removeData("sortable") .unbind(".sortable"); this._mouseDestroy(); @@ -169,7 +169,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this.dragging = true; - this.helper.addClass('ui-sortable-helper'); + this.helper.addClass(o.cssNamespace+'-sortable-helper'); this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position return true; @@ -270,7 +270,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { this._mouseUp(); if(this.options.helper == "original") - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + this.currentItem.css(this._storedCSS).removeClass(this.options.cssNamespace+"-sortable-helper"); else this.currentItem.show(); @@ -422,13 +422,13 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { for (var j = cur.length - 1; j >= 0; j--){ var inst = $.data(cur[j], 'sortable'); if(inst && inst != this && !inst.options.disabled) { - queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper"), inst]); + queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not("."+inst.options.cssNamespace+"-sortable-helper"), inst]); } }; }; } - queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper"), this]); + queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not("."+this.options.cssNamespace+"-sortable-helper"), this]); for (var i = queries.length - 1; i >= 0; i--){ queries[i][0].each(function() { @@ -552,8 +552,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { element: function() { var el = $(document.createElement(self.currentItem[0].nodeName)) - .addClass(className || self.currentItem[0].className+" ui-sortable-placeholder") - .removeClass('ui-sortable-helper')[0]; + .addClass(className || self.currentItem[0].className+" "+self.options.cssNamespace+"-sortable-placeholder") + .removeClass(self.options.cssNamespace+'-sortable-helper')[0]; if(!className) { el.style.visibility = "hidden"; @@ -823,12 +823,12 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { for(var i in this._storedCSS) { if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = ''; } - this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); + this.currentItem.css(this._storedCSS).removeClass(this.options.cssNamespace+"-sortable-helper"); } else { this.currentItem.show(); } - if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", event, null, noPropagation); //Trigger update callback if the DOM position has changed + if(this.domPosition.prev != this.currentItem.prev().not("."+this.options.cssNamespace+"-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", event, null, noPropagation); //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 this._propagate("remove", event, null, noPropagation); for (var i = this.containers.length - 1; i >= 0; i--){ @@ -896,6 +896,7 @@ $.extend($.ui.sortable, { accurateIntersection: true, appendTo: "parent", cancel: ":input,option", + cssNamespace: 'ui', delay: 0, distance: 1, dropOnEmpty: true, |