Skip to content

Commit bbb44f9

Browse files
committed
Tabs: Use ._bind() for main event handling.
1 parent 9b37ed2 commit bbb44f9

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

ui/jquery.ui.tabs.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -276,20 +276,18 @@ $.widget( "ui.tabs", {
276276
},
277277

278278
_setupEvents: function( event ) {
279-
// attach tab event handler, unbind to avoid duplicates from former tabifying...
280-
this.anchors.unbind( ".tabs" );
281-
282-
// TODO: use event delegation via _bind()
279+
var events = {
280+
click: function( event ) {
281+
event.preventDefault();
282+
}
283+
};
283284
if ( event ) {
284-
this.anchors.bind( event.split( " " ).join( ".tabs " ) + ".tabs",
285-
$.proxy( this, "_eventHandler" ) );
285+
$.each( event.split(" "), function( index, eventName ) {
286+
events[ eventName ] = "_eventHandler";
287+
});
286288
}
287-
288-
// TODO: use event delegation via _bind()
289-
// disable click in any case
290-
this.anchors.bind( "click.tabs", function( event ){
291-
event.preventDefault();
292-
});
289+
this.anchors.unbind( ".tabs" );
290+
this._bind( this.anchors, events );
293291
},
294292

295293
_eventHandler: function( event ) {

0 commit comments

Comments
 (0)