diff options
Diffstat (limited to 'ui/source/ui.core.js')
-rw-r--r-- | ui/source/ui.core.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/source/ui.core.js b/ui/source/ui.core.js index 7b96ced5a..31cd4a559 100644 --- a/ui/source/ui.core.js +++ b/ui/source/ui.core.js @@ -100,11 +100,18 @@ $.widget = function(name, prototype) { } return this.each(function() { - var instance = $.data(this, name); + var instance = $.data(this, name), self = this; + if (isMethodCall && instance) { instance[options].apply(instance, args); } else if (!isMethodCall) { - $.data(this, name, new $[namespace][name](this, options)); + var instance = new $[namespace][name](this, options), target = instance.element || this; + + if (target.is('.ui-wrapper')) { + self = target[0]; + } + + $.data(self, name, instance); } }); }; |