]> source.dussan.org Git - jquery-ui.git/commitdiff
core: cancel checks for type string before it's used
authorPaul Bakaus <paul.bakaus@googlemail.com>
Sun, 8 Jun 2008 11:00:47 +0000 (11:00 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Sun, 8 Jun 2008 11:00:47 +0000 (11:00 +0000)
draggable-test: changed cancel: true test: this should cancel on all elements, but simply do nothing, since true is a unsupported value.

tests/draggable.js
ui/ui.core.js
ui/ui.sortable.js

index 45b907d78e16b020b5b972e732496020b08ef880..d428a21ff4ed048725a2c618aef437c02bd8fe4a 100644 (file)
@@ -225,11 +225,6 @@ test("{ cancel: ? }, unexpected", function() {
                el = $("#draggable2").draggable({ cancel: val });
                drag(el, 50, 50);
                var expected = [50, 50];
-               switch(key) {
-                       case "true":
-                               expected = [0, 0]
-                               break; 
-               }
                moved(expected[0], expected[1], "cancel: " + key);
                el.draggable("destroy");
        })
index d7a28c9675d0ddf095771ebd2653a75e0811a84c..b20e492e42318c1f216592803126f77a1452a050 100644 (file)
@@ -198,7 +198,7 @@ $.ui.mouse = {
                
                var self = this,
                        btnIsLeft = (e.which == 1),
-                       elIsCancel = ($(e.target).is(this.options.cancel));
+                       elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false);
                if (!btnIsLeft || elIsCancel) {
                        return true;
                }
index 84eb0df93efe807b3fe0eabc6a52a99002e82119..9718dd1bc9b50b0a0e5e8bc6454fed4a8d9b01ca 100644 (file)
@@ -65,9 +65,7 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
                if(!noPropagation) this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui(inst)], this.options[n]);
        },
        serialize: function(o) {
-               
-               
-               
+
                var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself
                var str = []; o = o || {};
                
@@ -80,11 +78,13 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
                
        },
        toArray: function(attr) {
+               
                var items = ($.isFunction(this.options.items) ? this.options.items.call(this.element) : $(this.options.items, this.element)).not('.ui-sortable-helper'); //Only the items of the sortable itself
                var ret = [];
 
                items.each(function() { ret.push($(this).attr(attr || 'id')); });
                return ret;
+               
        },
        /* Be careful with the following core functions */
        intersectsWith: function(item) {