]> source.dussan.org Git - jquery-ui.git/commitdiff
Fix ui.core to create the $(this).data('component') instance on the "ui-wrapper"...
authorEduardo Lundgren <eduardolundgren@gmail.com>
Fri, 6 Jun 2008 03:27:56 +0000 (03:27 +0000)
committerEduardo Lundgren <eduardolundgren@gmail.com>
Fri, 6 Jun 2008 03:27:56 +0000 (03:27 +0000)
ui/source/ui.core.js

index 7b96ced5a19dda9a3ee13ff16e87f3015575739d..31cd4a55978b67ac213bfdebebd64dda0533c487 100644 (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);
                        }
                });
        };