mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-04-20 03:02:41 -04:00
Widget: Added "dynamic" bindings via ._bind() to allow for proxying.
This commit is contained in:
@@ -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 ) {
|
||||
|
||||
9
ui/jquery.ui.widget.js
vendored
9
ui/jquery.ui.widget.js
vendored
@@ -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 );
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user