diff options
author | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-06-06 03:27:56 +0000 |
---|---|---|
committer | Eduardo Lundgren <eduardolundgren@gmail.com> | 2008-06-06 03:27:56 +0000 |
commit | ebb04981a68445ad4bf302818b02e21940d41c25 (patch) | |
tree | bc40fe3752789f6eae1248731c88a5271217dfe4 | |
parent | 9ce9243b839ec6d6df4df91fe56287c3d7da42ed (diff) | |
download | jquery-ui-ebb04981a68445ad4bf302818b02e21940d41c25.tar.gz jquery-ui-ebb04981a68445ad4bf302818b02e21940d41c25.zip |
Fix ui.core to create the $(this).data('component') instance on the "ui-wrapper" element, that is the current "this" inside a $.ui.plugin.add.
-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); } }); }; |