]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Added "dynamic" bindings via ._bind() to allow for proxying.
authorScott González <scott.gonzalez@gmail.com>
Tue, 18 Jan 2011 06:53:20 +0000 (01:53 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 18 Jan 2011 06:53:20 +0000 (01:53 -0500)
tests/unit/widget/widget_core.js
ui/jquery.ui.widget.js

index f0afaa95605f5be87a689791347696eb13b55095..5ed0717dadeff9a855c976154b023d74713107df 100644 (file)
@@ -412,7 +412,7 @@ test( "_bind to element (default)", function() {
                        self = this;
                        this._bind({
                                keyup: this.keyup,
-                               keydown: this.keydown
+                               keydown: "keydown"
                        });
                },
                keyup: function( event ) {
@@ -452,7 +452,7 @@ test( "_bind to descendent", function() {
                        self = this;
                        this._bind( this.element.find( "strong" ), {
                                keyup: this.keyup,
-                               keydown: this.keydown
+                               keydown: "keydown"
                        });
                },
                keyup: function( event ) {
index 4d786e5c660365f06672a21dff818e7d8503a268..dd7992da2da74d74ba6b24733fe9c0678b94fcf2 100644 (file)
@@ -130,11 +130,7 @@ $.Widget.prototype = {
                        options );
 
                this.bindings = $();
-
-               var self = this;
-               this.element.bind( "remove." + this.widgetName, function() {
-                       self.destroy();
-               });
+               this._bind({ remove: "destroy" });
 
                this._create();
                this._trigger( "create" );
@@ -233,7 +229,8 @@ $.Widget.prototype = {
                                if ( instance.options.disabled ) {
                                        return;
                                }
-                               return handler.apply( instance, arguments );
+                               return ( typeof handler === "string" ? instance[ handler ] : handler )
+                                       .apply( instance, arguments );
                        });
                });
        },