mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-10-05 01:44:18 +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() {
|
return this.each(function() {
|
||||||
var instance = $.data(this, name);
|
var instance = $.data(this, name);
|
||||||
if (!instance) {
|
if (isMethodCall && instance) {
|
||||||
$.data(this, name, new $[namespace][name](this, options));
|
|
||||||
} else if (isMethodCall) {
|
|
||||||
instance[options].apply(instance, args);
|
instance[options].apply(instance, args);
|
||||||
|
} else if (!isMethodCall) {
|
||||||
|
$.data(this, name, new $[namespace][name](this, options));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user