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