aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2008-06-04 22:03:17 +0000
committerScott González <scott.gonzalez@gmail.com>2008-06-04 22:03:17 +0000
commit2b1bd34cef6a5e80555b5ff82acd8ddc25d6d3b3 (patch)
treef8681ae3809fbd6e847293f0ebd8b930ad2dc354
parent126d7d925b0b8d1a77e1fce58cc1c771e81e29b3 (diff)
downloadjquery-ui-2b1bd34cef6a5e80555b5ff82acd8ddc25d6d3b3.tar.gz
jquery-ui-2b1bd34cef6a5e80555b5ff82acd8ddc25d6d3b3.zip
Widget factory: fixed #2981: Graceful handling of method calls on uninitialized plugins.
-rw-r--r--ui/source/ui.core.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/source/ui.core.js b/ui/source/ui.core.js
index aa3c9f464..aff49eeda 100644
--- a/ui/source/ui.core.js
+++ b/ui/source/ui.core.js
@@ -101,10 +101,10 @@ $.widget = function(name, prototype) {
return this.each(function() {
var instance = $.data(this, name);
- if (!instance) {
- $.data(this, name, new $[namespace][name](this, options));
- } else if (isMethodCall) {
+ if (isMethodCall && instance) {
instance[options].apply(instance, args);
+ } else if (!isMethodCall) {
+ $.data(this, name, new $[namespace][name](this, options));
}
});
};