aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.droppable.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/ui.droppable.js')
-rw-r--r--ui/ui.droppable.js25
1 files changed, 10 insertions, 15 deletions
diff --git a/ui/ui.droppable.js b/ui/ui.droppable.js
index 5c80c7bfe..1d2f27e75 100644
--- a/ui/ui.droppable.js
+++ b/ui/ui.droppable.js
@@ -13,15 +13,9 @@
*/
(function($) {
-var widgetName = "droppable";
-var classWidgetName = ".droppable";
-
$.widget("ui.droppable", {
_init: function() {
- // update widgetName with the name given by the widget factory
- widgetName = this.widgetName;
- classWidgetName = '.' + widgetName;
var o = this.options, accept = o.accept;
this.isover = 0; this.isout = 1;
@@ -49,8 +43,8 @@ $.widget("ui.droppable", {
this.element
.removeClass(this.options.cssNamespace+"-droppable "+this.options.cssNamespace+"-droppable-disabled")
- .removeData(widgetName)
- .unbind(classWidgetName);
+ .removeData("droppable")
+ .unbind(".droppable");
},
_setData: function(key, value) {
@@ -111,8 +105,8 @@ $.widget("ui.droppable", {
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var childrenIntersection = false;
- this.element.find(":data(" + widgetName + ")").not("."+draggable.options.cssNamespace+"-draggable-dragging").each(function() {
- var inst = $.data(this, widgetName);
+ this.element.find(":data(droppable)").not("."+draggable.options.cssNamespace+"-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
childrenIntersection = true; return false;
}
@@ -209,9 +203,10 @@ $.ui.ddmanager = {
current: null,
droppables: { 'default': [] },
prepareOffsets: function(t, event) {
+
var m = $.ui.ddmanager.droppables[t.options.scope];
var type = event ? event.type : null; // workaround for #2317
- var list = (t.currentItem || t.element).find(":data(" + widgetName + ")").andSelf();
+ var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
droppablesLoop: for (var i = 0; i < m.length; i++) {
@@ -262,9 +257,9 @@ $.ui.ddmanager = {
var parentInstance;
if (this.options.greedy) {
- var parent = this.element.parents(':data(' + widgetName + '):eq(0)');
+ var parent = this.element.parents(':data(droppable):eq(0)');
if (parent.length) {
- parentInstance = $.data(parent[0], widgetName);
+ parentInstance = $.data(parent[0], 'droppable');
parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
}
}
@@ -294,7 +289,7 @@ $.ui.ddmanager = {
* Droppable Extensions
*/
-$.ui.plugin.add(widgetName, "activeClass", {
+$.ui.plugin.add("droppable", "activeClass", {
activate: function(event, ui) {
$(this).addClass(ui.options.activeClass);
},
@@ -306,7 +301,7 @@ $.ui.plugin.add(widgetName, "activeClass", {
}
});
-$.ui.plugin.add(widgetName, "hoverClass", {
+$.ui.plugin.add("droppable", "hoverClass", {
over: function(event, ui) {
$(this).addClass(ui.options.hoverClass);
},