diff --git a/ui/ui.core.js b/ui/ui.core.js index 3d78c973a..22597bf9d 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -89,11 +89,14 @@ $.widget = function(name, prototype) { // handle initialization and non-getter methods return this.each(function() { var instance = $.data(this, name); - if (isMethodCall && instance && $.isFunction(instance[options])) { - instance[options].apply(instance, args); - } else if (!isMethodCall) { - $.data(this, name, new $[namespace][name](this, options)); - } + + // constructor + (!instance && !isMethodCall && + $.data(this, name, new $[namespace][name](this, options))); + + // method call + (instance && isMethodCall && + instance[options].apply(instance, args)); }); };