]> source.dussan.org Git - jquery-ui.git/commitdiff
Merged in widget-factory branch and added tests. Fixes #4411 - Widget factory should...
authorScott González <scott.gonzalez@gmail.com>
Wed, 15 Apr 2009 02:33:28 +0000 (02:33 +0000)
committerScott González <scott.gonzalez@gmail.com>
Wed, 15 Apr 2009 02:33:28 +0000 (02:33 +0000)
20 files changed:
tests/unit/accordion/accordion_methods.js
tests/unit/dialog/dialog_methods.js
tests/unit/draggable/draggable_methods.js
tests/unit/droppable/droppable_methods.js
tests/unit/progressbar/progressbar_methods.js
tests/unit/resizable/resizable_methods.js
tests/unit/selectable/selectable_methods.js
tests/unit/slider/slider_methods.js
tests/unit/sortable/sortable_methods.js
ui/ui.accordion.js
ui/ui.core.js
ui/ui.dialog.js
ui/ui.draggable.js
ui/ui.droppable.js
ui/ui.progressbar.js
ui/ui.resizable.js
ui/ui.selectable.js
ui/ui.slider.js
ui/ui.sortable.js
ui/ui.tabs.js

index 8b3a491a8e709a9782552dc592f326f79f4e967d..e13a4a47effb65875472a44e62e3f0b658d8ee34 100644 (file)
@@ -10,17 +10,32 @@ test("init", function() {
 });
 
 test("destroy", function() {
+       var expected = $('#list1').accordion(),
+               actual = expected.accordion('destroy');
+       equals(actual, expected, 'destroy is chainable');
        ok(false, 'missing test - untested code is broken code');
 });
 
 test("enable", function() {
+       var expected = $('#list1').accordion(),
+               actual = expected.accordion('enable');
+       equals(actual, expected, 'enable is chainable');
        ok(false, 'missing test - untested code is broken code');
 });
 
 test("disable", function() {
+       var expected = $('#list1').accordion(),
+               actual = expected.accordion('disable');
+       equals(actual, expected, 'disable is chainable');
        ok(false, 'missing test - untested code is broken code');
 });
 
+test("activate", function() {
+       var expected = $('#list1').accordion(),
+               actual = expected.accordion('activate', 2);
+       equals(actual, expected, 'activate is chainable');
+});
+
 test("activate, numeric", function() {
        var ac = $('#list1').accordion({ active: 1 });
        state(ac, 0, 1, 0);
@@ -74,4 +89,11 @@ test("activate, jQuery or DOM element", function() {
        state(ac, 0, 1, 0);
 });
 
+test("resize", function() {
+       var expected = $('#list1').accordion(),
+               actual = expected.accordion('resize');
+       equals(actual, expected, 'resize is chainable');
+       ok(false, 'missing test - untested code is broken code');
+});
+
 })(jQuery);
index 897c745818bfce0b63da8595077f781495c57021..5748a27dabd6ef0de41db1bb24ae48732fd50122 100644 (file)
@@ -33,7 +33,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').dialog().dialog("destroy").remove();
        ok(true, '.dialog("destroy") called on element');
@@ -54,6 +54,31 @@ test("destroy", function() {
 
        $('<div></div>').dialog().dialog("destroy").data("foo.dialog", "bar").remove();
        ok(true, 'arbitrary option setter after destroy');
+
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('destroy');
+       equals(actual, expected, 'destroy is chainable');
+});
+
+test("enable", function() {
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('enable');
+       equals(actual, expected, 'enable is chainable');
+       ok(false, 'missing test - untested code is broken code');
+});
+
+test("disable", function() {
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('disable');
+       equals(actual, expected, 'disable is chainable');
+       ok(false, 'missing test - untested code is broken code');
+});
+
+test("close", function() {
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('close');
+       equals(actual, expected, 'close is chainable');
+       ok(false, 'missing test - untested code is broken code');
 });
 
 test("isOpen", function() {
@@ -72,4 +97,18 @@ test("isOpen", function() {
        el.remove();
 });
 
+test("moveToTop", function() {
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('moveToTop');
+       equals(actual, expected, 'moveToTop is chainable');
+       ok(false, 'missing test - untested code is broken code');
+});
+
+test("open", function() {
+       var expected = $('<div></div>').dialog(),
+               actual = expected.dialog('open');
+       equals(actual, expected, 'open is chainable');
+       ok(false, 'missing test - untested code is broken code');
+});
+
 })(jQuery);
index 6a931bfe78f3d48c2bd7678474d0aa56a235434f..9de83e4511258b5a98aaf949dd5579f89e453692 100644 (file)
@@ -38,7 +38,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').draggable().draggable("destroy").remove();
        ok(true, '.draggable("destroy") called on element');
@@ -57,10 +57,14 @@ test("destroy", function() {
 
        $("<div></div>").draggable().draggable("destroy").data("foo.draggable", "bar");
        ok(true, 'arbitrary option setter after destroy');
+       
+       var expected = $('<div></div>').draggable(),
+               actual = expected.draggable('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
-       expect(6);
+       expect(7);
        el = $("#draggable2").draggable({ disabled: true });
        shouldnotmove('.draggable({ disabled: true })');
        el.draggable("enable");
@@ -73,10 +77,14 @@ test("enable", function() {
        el.data("disabled.draggable", false);
        equals(el.data("disabled.draggable"), false, "disabled.draggable setter");
        shouldmove('.data("disabled.draggable", false)');
+       
+       var expected = $('<div></div>').draggable(),
+               actual = expected.draggable('enable');
+       equals(actual, expected, 'enable is chainable');
 });
 
 test("disable", function() {
-       expect(6);
+       expect(7);
        el = $("#draggable2").draggable({ disabled: false });
        shouldmove('.draggable({ disabled: false })');
        el.draggable("disable");
@@ -90,6 +98,10 @@ test("disable", function() {
        el.data("disabled.draggable", true);
        equals(el.data("disabled.draggable"), true, "disabled.draggable setter");
        shouldnotmove('.data("disabled.draggable", true)');
+       
+       var expected = $('<div></div>').draggable(),
+               actual = expected.draggable('disable');
+       equals(actual, expected, 'disable is chainable');
 });
 
 })(jQuery);
index 51f54089d1d1c1cd516fc42118b43173b10e4e7e..51cb65e741c72690ae1e40f9157a16e88e8edbcd 100644 (file)
@@ -28,7 +28,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').droppable().droppable("destroy").remove();
        ok(true, '.droppable("destroy") called on element');
@@ -47,10 +47,14 @@ test("destroy", function() {
 
        $("<div></div>").droppable().droppable("destroy").data("foo.droppable", "bar");
        ok(true, 'arbitrary option setter after destroy');
+       
+       var expected = $('<div></div>').droppable(),
+               actual = expected.droppable('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
-       expect(6);
+       expect(7);
        el = $("#droppable1").droppable({ disabled: true });
        shouldNotBeDroppable();
        el.droppable("enable");
@@ -62,10 +66,14 @@ test("enable", function() {
        el.data("disabled.droppable", false);
        equals(el.data("disabled.droppable"), false, "disabled.droppable setter");
        shouldBeDroppable();
+       
+       var expected = $('<div></div>').droppable(),
+               actual = expected.droppable('enable');
+       equals(actual, expected, 'enable is chainable');
 });
 
 test("disable", function() {
-       expect(6);
+       expect(7);
        el = $("#droppable1").droppable({ disabled: false });
        shouldBeDroppable();
        el.droppable("disable");
@@ -77,6 +85,10 @@ test("disable", function() {
        el.data("disabled.droppable", true);
        equals(el.data("disabled.droppable"), true, "disabled.droppable setter");
        shouldNotBeDroppable();
+       
+       var expected = $('<div></div>').droppable(),
+               actual = expected.droppable('disable');
+       equals(actual, expected, 'disable is chainable');
 });
 
 })(jQuery);
index ece100e02f18498747c0d4936763e92f4fd82408..9a162685bfa914e9dc5de73465fc1cecbf7f4ed3 100644 (file)
@@ -14,11 +14,14 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(1);
+       expect(2);
 
        $("<div></div>").appendTo('body').progressbar().progressbar("destroy").remove();
        ok(true, '.progressbar("destroy") called on element');
 
+       var expected = $('<div></div>').progressbar(),
+               actual = expected.progressbar('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 })(jQuery);
index 43d57338795c83524dea7af4894617e0627d626a..e029e00cf8183955eb028769dfdcab709fb9e0dd 100644 (file)
@@ -30,7 +30,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').resizable().resizable("destroy").remove();
        ok(true, '.resizable("destroy") called on element');
@@ -51,13 +51,23 @@ test("destroy", function() {
 
        $('<div></div>').resizable().resizable("destroy").data("foo.resizable", "bar").remove();
        ok(true, 'arbitrary option setter after destroy');
+       
+       var expected = $('<div></div>').resizable(),
+               actual = expected.resizable('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
+       var expected = $('<div></div>').resizable(),
+               actual = expected.resizable('enable');
+       equals(actual, expected, 'enable is chainable');
        ok(false, "missing test - untested code is broken code.");
 });
 
 test("disable", function() {
+       var expected = $('<div></div>').resizable(),
+               actual = expected.resizable('disable');
+       equals(actual, expected, 'disable is chainable');
        ok(false, "missing test - untested code is broken code.");
 });
 
index 0f52ec7e4d88b44fb69049f73cc402622a265c12..4d1701440060dfa8c0a098599444efc87d8739d7 100644 (file)
@@ -30,7 +30,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').selectable().selectable("destroy").remove();
        ok(true, '.selectable("destroy") called on element');
@@ -51,10 +51,14 @@ test("destroy", function() {
 
        $("<div></div>").selectable().selectable("destroy").data("foo.selectable", "bar").remove();
        ok(true, 'arbitrary option setter after destroy');
+       
+       var expected = $('<div></div>').selectable(),
+               actual = expected.selectable('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
-       expect(2);
+       expect(3);
        var fired = false;
 
        el = $("#selectable1");
@@ -68,10 +72,14 @@ test("enable", function() {
        el.simulate("drag", 20, 20);
        equals(fired, true, "start fired");
        el.selectable("destroy");
+       
+       var expected = $('<div></div>').selectable(),
+               actual = expected.selectable('enable');
+       equals(actual, expected, 'enable is chainable');
 });
 
 test("disable", function() {
-       expect(2);
+       expect(3);
        var fired = false;
 
        el = $("#selectable1");
@@ -86,6 +94,10 @@ test("disable", function() {
        el.simulate("drag", 20, 20);
        equals(fired, false, "start fired");
        el.selectable("destroy");
+       
+       var expected = $('<div></div>').selectable(),
+               actual = expected.selectable('disable');
+       equals(actual, expected, 'disable is chainable');
 });
 
 })(jQuery);
index 05b8905b163a62911ddd4fea55ee7a7447a3610e..92d8237b982bfc2687824a6295a3e824fa042bdd 100644 (file)
@@ -30,7 +30,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(8);
+       expect(9);
 
        $("<div></div>").appendTo('body').slider().slider("destroy").remove();
        ok(true, '.slider("destroy") called on element');
@@ -59,13 +59,23 @@ test("destroy", function() {
 
        $('<div></div>').slider().slider("destroy").slider("options", "foo", "bar").remove();
        ok(true, 'arbitrary option setter (.slider option method) after destroy');
+       
+       var expected = $('<div></div>').slider(),
+               actual = expected.slider('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
+       var expected = $('<div></div>').slider(),
+               actual = expected.slider('enable');
+       equals(actual, expected, 'enable is chainable');
        ok(false, "missing test - untested code is broken code.");
 });
 
 test("disable", function() {
+       var expected = $('<div></div>').slider(),
+               actual = expected.slider('disable');
+       equals(actual, expected, 'disable is chainable');
        ok(false, "missing test - untested code is broken code.");
 });
 
index e19ccc58f4d4a5d69fc0d9f6e161e1c1c04e8b95..74d7be02e864abd14f30967fd01a880d686c29f2 100644 (file)
@@ -45,7 +45,7 @@ test("init", function() {
 });
 
 test("destroy", function() {
-       expect(6);
+       expect(7);
 
        $("<div></div>").appendTo('body').sortable().sortable("destroy").remove();
        ok(true, '.sortable("destroy") called on element');
@@ -64,10 +64,14 @@ test("destroy", function() {
 
        $("<div></div>").sortable().sortable("destroy").data("foo.sortable", "bar");
        ok(true, 'arbitrary option setter after destroy');
+       
+       var expected = $('<div></div>').sortable(),
+               actual = expected.sortable('destroy');
+       equals(actual, expected, 'destroy is chainable');
 });
 
 test("enable", function() {
-       expect(4);
+       expect(5);
        el = $("#sortable").sortable({ disabled: true });
 
        sort($("li", el)[0], 0, 40, 0, '.sortable({ disabled: true })');
@@ -81,10 +85,14 @@ test("enable", function() {
        equals(el.data("disabled.sortable"), false, "disabled.sortable setter");
 
        sort($("li", el)[0], 0, 40, 2, '.data("disabled.sortable", false)');
+       
+       var expected = $('<div></div>').sortable(),
+               actual = expected.sortable('enable');
+       equals(actual, expected, 'enable is chainable');
 });
 
 test("disable", function() {
-       expect(5);
+       expect(6);
        el = $("#sortable").sortable({ disabled: false });
        sort($("li", el)[0], 0, 40, 2, '.sortable({ disabled: false })');
 
@@ -98,6 +106,10 @@ test("disable", function() {
        el.data("disabled.sortable", true);
        equals(el.data("disabled.sortable"), true, "disabled.sortable setter");
        sort($("li", el)[0], 0, 40, 0, '.data("disabled.sortable", true)');
+       
+       var expected = $('<div></div>').sortable(),
+               actual = expected.sortable('disable');
+       equals(actual, expected, 'disable is chainable');
 });
 
 })(jQuery);
index 0a625e5d33ba0721224f6527be73e50878432209..c7e55f5c80df026de7a7c3896196ed2bf0e1bdab 100644 (file)
@@ -125,6 +125,8 @@ $.widget("ui.accordion", {
                if (o.autoHeight || o.fillHeight) {
                        contents.css("height", "");
                }
+
+               return this;
        },
        
        _setData: function(key, value) {
@@ -195,12 +197,15 @@ $.widget("ui.accordion", {
                        }).height(maxHeight);
                }
 
+               return this;
        },
 
        activate: function(index) {
                // call clickHandler with custom event
                var active = this._findActive(index)[0];
                this._clickHandler({ target: active }, active);
+
+               return this;
        },
 
        _findActive: function(selector) {
index d95ec747b5149ed7c3d6ee5374beb2ad33391a7c..27b12681d95b385c4c1b7638ac99807988f6c50f 100644 (file)
@@ -203,19 +203,6 @@ $.extend($.expr[':'], {
 
 // $.widget is a factory to create jQuery plugins
 // taking some boilerplate code out of the plugin code
-function getter(namespace, plugin, method, args) {
-       function getMethods(type) {
-               var methods = $[namespace][plugin][type] || [];
-               return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
-       }
-
-       var methods = getMethods('getter');
-       if (args.length == 1 && typeof args[0] == 'string') {
-               methods = methods.concat(getMethods('getterSetter'));
-       }
-       return ($.inArray(method, methods) != -1);
-}
-
 $.widget = function(name, prototype) {
        var namespace = name.split(".")[0],
                fullName;
@@ -230,32 +217,31 @@ $.widget = function(name, prototype) {
        // create plugin method
        $.fn[name] = function(options) {
                var isMethodCall = (typeof options == 'string'),
-                       args = Array.prototype.slice.call(arguments, 1);
+                       args = Array.prototype.slice.call(arguments, 1),
+                       returnValue = this;
 
                // prevent calls to internal methods
                if (isMethodCall && options.substring(0, 1) == '_') {
-                       return this;
-               }
-
-               // handle getter methods
-               if (isMethodCall && getter(namespace, name, options, args)) {
-                       var instance = $.data(this[0], name);
-                       return (instance ? instance[options].apply(instance, args)
-                               : undefined);
+                       return returnValue;
                }
 
-               // handle initialization and non-getter methods
-               return this.each(function() {
-                       var instance = $.data(this, name);
-
-                       // constructor
-                       (!instance && !isMethodCall &&
-                               $.data(this, name, new $[namespace][name](this, options))._init());
+               (isMethodCall
+                       ? this.each(function() {
+                               var instance = $.data(this, name),
+                                       methodValue = (instance && $.isFunction(instance[options])
+                                               ? instance[options].apply(instance, args)
+                                               : instance);
+                               if (methodValue !== instance) {
+                                       returnValue = methodValue;
+                                       return false;
+                               }
+                       })
+                       : this.each(function() {
+                               ($.data(this, name) ||
+                                       $.data(this, name, new $[namespace][name](this, options))._init());
+                       }));
 
-                       // method call
-                       (instance && isMethodCall && $.isFunction(instance[options]) &&
-                               instance[options].apply(instance, args));
-               });
+               return returnValue;
        };
 
        // create widget constructor
@@ -292,10 +278,6 @@ $.widget = function(name, prototype) {
 
        // add widget prototype
        $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);
-
-       // TODO: merge getter and getterSetter properties from widget prototype
-       // and plugin prototype
-       $[namespace][name].getterSetter = 'option';
 };
 
 $.widget.prototype = {
@@ -304,6 +286,8 @@ $.widget.prototype = {
                this.element.removeData(this.widgetName)
                        .removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
                        .removeAttr('aria-disabled');
+
+               return this;
        },
 
        option: function(key, value) {
@@ -321,6 +305,8 @@ $.widget.prototype = {
                $.each(options, function(key, value) {
                        self._setData(key, value);
                });
+
+               return self;
        },
        _getData: function(key) {
                return this.options[key];
@@ -339,9 +325,11 @@ $.widget.prototype = {
 
        enable: function() {
                this._setData('disabled', false);
+               return this;
        },
        disable: function() {
                this._setData('disabled', true);
+               return this;
        },
 
        _trigger: function(type, event, data) {
index d8b348c9b21950f9e075a2c5106efc12c208cebe..18bdfa6bb8d6aed964b1ba9a37005fdac3ba5cdc 100644 (file)
@@ -137,7 +137,6 @@ $.widget("ui.dialog", {
 
                (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe());
                (options.autoOpen && this.open());
-               
        },
 
        destroy: function() {
@@ -151,6 +150,8 @@ $.widget("ui.dialog", {
                this.uiDialog.remove();
 
                (this.originalTitle && this.element.attr('title', this.originalTitle));
+
+               return this;
        },
 
        close: function(event) {
@@ -172,7 +173,7 @@ $.widget("ui.dialog", {
                $.ui.dialog.overlay.resize();
 
                self._isOpen = false;
-               
+
                // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
                if (self.options.modal) {
                        var maxZ = 0;
@@ -183,6 +184,8 @@ $.widget("ui.dialog", {
                        });
                        $.ui.dialog.maxZ = maxZ;
                }
+
+               return self;
        },
 
        isOpen: function() {
@@ -192,7 +195,6 @@ $.widget("ui.dialog", {
        // the force parameter allows us to move modal dialogs to their correct
        // position on open
        moveToTop: function(force, event) {
-
                if ((this.options.modal && !force)
                        || (!this.options.stack && !this.options.modal)) {
                        return this._trigger('focus', event);
@@ -209,6 +211,8 @@ $.widget("ui.dialog", {
                this.uiDialog.css('z-index', ++$.ui.dialog.maxZ);
                this.element.attr(saveScroll);
                this._trigger('focus', event);
+
+               return this;
        },
 
        open: function() {
@@ -256,6 +260,8 @@ $.widget("ui.dialog", {
 
                this._trigger('open');
                this._isOpen = true;
+
+               return this;
        },
 
        _createButtons: function(buttons) {
@@ -519,8 +525,6 @@ $.extend($.ui.dialog, {
                zIndex: 1000
        },
 
-       getter: 'isOpen',
-
        uuid: 0,
        maxZ: 0,
 
index c408ae8b0b57c1b2215fdb58f3134bea5111f9c5..4a11d3a61e0207ced7a6ce726975004f5045e9ff 100644 (file)
@@ -35,6 +35,8 @@ $.widget("ui.draggable", $.extend({}, $.ui.mouse, {
                                + " ui-draggable-dragging"
                                + " ui-draggable-disabled");
                this._mouseDestroy();
+
+               return this;
        },
 
        _mouseCapture: function(event) {
index e4c187c2624560aa10b333ad953e54e4359e3cec..ee9172780fb964831728b2ac4969126245420952 100644 (file)
@@ -45,6 +45,8 @@ $.widget("ui.droppable", {
                        .removeClass("ui-droppable ui-droppable-disabled")
                        .removeData("droppable")
                        .unbind(".droppable");
+
+               return this;
        },
 
        _setData: function(key, value) {
index e72b31e5de0700ffe176efa3d2055ab1e3c6f995..6988f8dffb49949fa5dffc3598d1e6a63abffdd9 100644 (file)
@@ -52,6 +52,7 @@ $.widget("ui.progressbar", {
 
                $.widget.prototype.destroy.apply(this, arguments);
 
+               return this;
        },
 
        value: function(newValue) {
index fef9e4b3690f2b1069a4d3c25b9441e6fef1e70a..6e5691aeae10684ef3c63522c6098bc5d4a363b5 100644 (file)
@@ -199,6 +199,7 @@ $.widget("ui.resizable", $.extend({}, $.ui.mouse, {
                this.originalElement.css('resize', this.originalResizeStyle);
                _destroy(this.originalElement);
 
+               return this;
        },
 
        _mouseCapture: function(event) {
index 49cdd805f2312a763e1f2ad0c132d0d80ae1ba6e..93d0c8ca88a8406e8def03b198ab4be3874183e6 100644 (file)
@@ -59,6 +59,8 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
                        .removeData("selectable")
                        .unbind(".selectable");
                this._mouseDestroy();
+
+               return this;
        },
 
        _mouseStart: function(event) {
index 2eee4f2d867d309f4033c8ad24d1ad0bd1b85ea0..2f5ac1e7b009f09bd0de0612c2217f11dda69f1d 100644 (file)
@@ -192,6 +192,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
 
                this._mouseDestroy();
 
+               return this;
        },
 
        _mouseCapture: function(event) {
@@ -536,7 +537,6 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
 }));
 
 $.extend($.ui.slider, {
-       getter: "value values",
        version: "@VERSION",
        eventPrefix: "slide",
        defaults: {
index 01f41cd33e3e9090237755dcd888f617f476734a..76cce9aa6a42c869055e2994160ac582c74ae0ec 100644 (file)
@@ -42,6 +42,8 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
 
                for ( var i = this.items.length - 1; i >= 0; i-- )
                        this.items[i].item.removeData("sortable-item");
+
+               return this;
        },
 
        _mouseCapture: function(event, overrideHandle) {
@@ -354,7 +356,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                        $(this.domPosition.parent).prepend(this.currentItem);
                }
 
-               return true;
+               return this;
 
        },
 
@@ -460,6 +462,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
        refresh: function(event) {
                this._refreshItems(event);
                this.refreshPositions();
+               return this;
        },
 
        _connectWith: function() {
@@ -595,6 +598,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
                        };
                }
 
+               return this;
        },
 
        _createPlaceholder: function(that) {
@@ -984,7 +988,6 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
 }));
 
 $.extend($.ui.sortable, {
-       getter: "serialize toArray",
        version: "@VERSION",
        eventPrefix: "sort",
        defaults: {
index 1a52ce3ee4cf9d00bb30dfaef74989345f5c35db..c09ce038d4d4e766bd994a6a481ac61ec4be65aa 100644 (file)
@@ -434,6 +434,8 @@ $.widget("ui.tabs", {
                if (o.cookie) {
                        this._cookie(null, o.cookie);
                }
+
+               return this;
        },
 
        add: function(url, label, index) {
@@ -480,6 +482,7 @@ $.widget("ui.tabs", {
 
                // callback
                this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
+               return this;
        },
 
        remove: function(index) {
@@ -499,6 +502,7 @@ $.widget("ui.tabs", {
 
                // callback
                this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
+               return this;
        },
 
        enable: function(index) {
@@ -512,6 +516,7 @@ $.widget("ui.tabs", {
 
                // callback
                this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
+               return this;
        },
 
        disable: function(index) {
@@ -525,6 +530,8 @@ $.widget("ui.tabs", {
                        // callback
                        this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
                }
+
+               return this;
        },
 
        select: function(index) {
@@ -539,6 +546,7 @@ $.widget("ui.tabs", {
                }
 
                this.anchors.eq(index).trigger(this.options.event + '.tabs');
+               return this;
        },
 
        load: function(index) {
@@ -583,6 +591,8 @@ $.widget("ui.tabs", {
                                self.element.dequeue("tabs");
                        }
                }));
+
+               return this;
        },
 
        abort: function() {
@@ -598,11 +608,12 @@ $.widget("ui.tabs", {
 
                // take care of tab labels
                this._cleanup();
-
+               return this;
        },
 
        url: function(index, url) {
                this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
+               return this;
        },
 
        length: function() {
@@ -613,7 +624,6 @@ $.widget("ui.tabs", {
 
 $.extend($.ui.tabs, {
        version: '@VERSION',
-       getter: 'length',
        defaults: {
                ajaxOptions: null,
                cache: false,
@@ -679,6 +689,8 @@ $.extend($.ui.tabs.prototype, {
                        delete this._rotate;
                        delete this._unrotate;
                }
+
+               return this;
        }
 });