Skip to content
Permalink
Browse files

Widget factory: Fixed #3275: Prevent multiple instantiations of the s…

…ame plugin on a single element.
  • Loading branch information
scottgonzalez committed Sep 2, 2008
1 parent b95772e commit ccdb99e313edc48f423c6ec75a052e8f8d268268
Showing with 8 additions and 5 deletions.
  1. +8 −5 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));
});
};

0 comments on commit ccdb99e

Please sign in to comment.
You can’t perform that action at this time.