Widget: Added "dynamic" bindings via ._bind() to allow for proxying.

This commit is contained in:
Scott González
2011-01-18 01:53:20 -05:00
parent 659db70caa
commit 6072703cd1
2 changed files with 5 additions and 8 deletions

View 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 ) {

View 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 );
});
});
},