aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/ui.core.js13
1 files changed, 8 insertions, 5 deletions
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));
});
};