From ebb04981a68445ad4bf302818b02e21940d41c25 Mon Sep 17 00:00:00 2001 From: Eduardo Lundgren Date: Fri, 6 Jun 2008 03:27:56 +0000 Subject: [PATCH] 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. --- ui/source/ui.core.js | 11 +++++++++-- 1 file 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); } }); }; -- 2.39.5