]> source.dussan.org Git - jquery-ui.git/commitdiff
Fixed #4037 (droppable: cssNamespace option should be removed, addClasses option...
authorRichard Worth <rdworth@gmail.com>
Mon, 2 Feb 2009 07:18:27 +0000 (07:18 +0000)
committerRichard Worth <rdworth@gmail.com>
Mon, 2 Feb 2009 07:18:27 +0000 (07:18 +0000)
tests/unit/droppable/droppable_options.js
ui/ui.droppable.js

index 2df2dcb15c88ac4a3782cbf6a2d4696d0830d6cd..c63429bc53c9b85b450bc2719d75112820eba54b 100644 (file)
@@ -22,22 +22,12 @@ test("{ addClasses: true }, default", function() {
 
        el = $("<div></div>").droppable({ addClasses: true });
        ok(el.is(".ui-droppable"), "'ui-droppable' class added");
+       el.droppable("destroy");
 });
 
 test("{ addClasses: false }", function() {
        el = $("<div></div>").droppable({ addClasses: false });
        ok(!el.is(".ui-droppable"), "'ui-droppable' class not added");
-});
-
-test("cssNamespace", function() {
-       //cssNamespace should be appended with '-droppable' and added as className
-       el = $("<div></div>").droppable({ cssNamespace: "ui" });
-       equals(el[0].className, "ui-droppable");
-       el.droppable("destroy");
-
-       //no className should be added if cssNamepsace is null
-       el = $("<div></div>").droppable({ cssNamespace: null });
-       equals(el[0].className, "");
        el.droppable("destroy");
 });
 
index 600f3d7a3a03191209d26f815d717a4d4624300e..3c6c524e4b951069a44f4776eb9043bf38bfac05 100644 (file)
@@ -31,7 +31,7 @@ $.widget("ui.droppable", {
                $.ui.ddmanager.droppables[this.options.scope] = $.ui.ddmanager.droppables[this.options.scope] || [];
                $.ui.ddmanager.droppables[this.options.scope].push(this);
 
-               (this.options.cssNamespace && this.element.addClass(this.options.cssNamespace+"-droppable"));
+               (this.options.addClasses && this.element.addClass("ui-droppable"));
 
        },
 
@@ -42,7 +42,7 @@ $.widget("ui.droppable", {
                                drop.splice(i, 1);
 
                this.element
-                       .removeClass(this.options.cssNamespace+"-droppable "+this.options.cssNamespace+"-droppable-disabled")
+                       .removeClass("ui-droppable ui-droppable-disabled")
                        .removeData("droppable")
                        .unbind(".droppable");
        },
@@ -101,7 +101,7 @@ $.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(droppable)").not("."+draggable.options.cssNamespace+"-draggable-dragging").each(function() {
+               this.element.find(":data(droppable)").not(".ui-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;
@@ -136,9 +136,9 @@ $.extend($.ui.droppable, {
        version: "@VERSION",
        eventPrefix: 'drop',
        defaults: {
+               addClasses: true,
                accept: '*',
                activeClass: false,
-               cssNamespace: 'ui',
                greedy: false,
                hoverClass: false,
                scope: 'default',