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.

This commit is contained in:
Eduardo Lundgren 2008-06-06 03:27:56 +00:00
parent 9ce9243b83
commit ebb04981a6

View File

@ -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);
}
});
};