mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Widget factory: fixed #2981: Graceful handling of method calls on uninitialized plugins.
This commit is contained in:
parent
126d7d925b
commit
2b1bd34cef
@ -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));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user