aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.core.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-09-02 23:34:42 +0000
committerScott González <scott.gonzalez@gmail.com>2008-09-02 23:34:42 +0000
commitccdb99e313edc48f423c6ec75a052e8f8d268268 (patch)
tree7b9b9bd25b82cca4f73cf235e5fc74e864df1ac7 /ui/ui.core.js
parentb95772ef09e0ae73f1fec1821e16a7e1874c7181 (diff)
downloadjquery-ui-ccdb99e313edc48f423c6ec75a052e8f8d268268.tar.gz
jquery-ui-ccdb99e313edc48f423c6ec75a052e8f8d268268.zip
Widget factory: Fixed #3275: Prevent multiple instantiations of the same plugin on a single element.
Diffstat (limited to 'ui/ui.core.js')
-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));
});
};