Skip to content

Commit 6072703

Browse files
committed
Widget: Added "dynamic" bindings via ._bind() to allow for proxying.
1 parent 659db70 commit 6072703

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

tests/unit/widget/widget_core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ test( "_bind to element (default)", function() {
412412
self = this;
413413
this._bind({
414414
keyup: this.keyup,
415-
keydown: this.keydown
415+
keydown: "keydown"
416416
});
417417
},
418418
keyup: function( event ) {
@@ -452,7 +452,7 @@ test( "_bind to descendent", function() {
452452
self = this;
453453
this._bind( this.element.find( "strong" ), {
454454
keyup: this.keyup,
455-
keydown: this.keydown
455+
keydown: "keydown"
456456
});
457457
},
458458
keyup: function( event ) {

ui/jquery.ui.widget.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,7 @@ $.Widget.prototype = {
130130
options );
131131

132132
this.bindings = $();
133-
134-
var self = this;
135-
this.element.bind( "remove." + this.widgetName, function() {
136-
self.destroy();
137-
});
133+
this._bind({ remove: "destroy" });
138134

139135
this._create();
140136
this._trigger( "create" );
@@ -233,7 +229,8 @@ $.Widget.prototype = {
233229
if ( instance.options.disabled ) {
234230
return;
235231
}
236-
return handler.apply( instance, arguments );
232+
return ( typeof handler === "string" ? instance[ handler ] : handler )
233+
.apply( instance, arguments );
237234
});
238235
});
239236
},

0 commit comments

Comments
 (0)