Skip to content

Commit

Permalink
Fixed #4037 (droppable: cssNamespace option should be removed, addCla…
Browse files Browse the repository at this point in the history
…sses option added)
  • Loading branch information
rdworth committed Feb 2, 2009
1 parent 977c6e9 commit 4ad5310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
12 changes: 1 addition & 11 deletions tests/unit/droppable/droppable_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down
8 changes: 4 additions & 4 deletions ui/ui.droppable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

},

Expand All @@ -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");
},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 4ad5310

Please sign in to comment.