Tabs: Use ._bind() for main event handling.

This commit is contained in:
Scott González 2012-05-22 15:12:38 -04:00
parent 9b37ed24ce
commit bbb44f9e67

22
ui/jquery.ui.tabs.js vendored
View File

@ -276,20 +276,18 @@ $.widget( "ui.tabs", {
},
_setupEvents: function( event ) {
// attach tab event handler, unbind to avoid duplicates from former tabifying...
this.anchors.unbind( ".tabs" );
// TODO: use event delegation via _bind()
if ( event ) {
this.anchors.bind( event.split( " " ).join( ".tabs " ) + ".tabs",
$.proxy( this, "_eventHandler" ) );
}
// TODO: use event delegation via _bind()
// disable click in any case
this.anchors.bind( "click.tabs", function( event ){
var events = {
click: function( event ) {
event.preventDefault();
}
};
if ( event ) {
$.each( event.split(" "), function( index, eventName ) {
events[ eventName ] = "_eventHandler";
});
}
this.anchors.unbind( ".tabs" );
this._bind( this.anchors, events );
},
_eventHandler: function( event ) {