});
// addTab form: calls addTab function on submit and closes the dialog
- var form = dialog.find( "form" ).submit(function( event ) {
+ var form = dialog.find( "form" ).on( "submit", function( event ) {
addTab();
dialog.dialog( "close" );
event.preventDefault();
// addTab button: just opens the dialog
$( "#add_tab" )
.button()
- .click(function() {
+ .on( "click", function() {
dialog.dialog( "open" );
});
// close icon: removing the tab on click
- tabs.delegate( "span.ui-icon-close", "click", function() {
+ tabs.on( "click", "span.ui-icon-close", function() {
var panelId = $( this ).closest( "li" ).remove().attr( "aria-controls" );
$( "#" + panelId ).remove();
tabs.tabs( "refresh" );
});
- tabs.bind( "keyup", function( event ) {
+ tabs.on( "keyup", function( event ) {
if ( event.altKey && event.keyCode === $.ui.keyCode.BACKSPACE ) {
var panelId = tabs.find( ".ui-tabs-active" ).remove().attr( "aria-controls" );
$( "#" + panelId ).remove();
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
state( element, 1, 0, 0 );
});
- anchors.eq( 1 ).click();
+ anchors.eq( 1 ).trigger( "click" );
state( element, 0, 1, 0 );
// collapsing
strictEqual( ui.newPanel[ 0 ], panels[ 1 ], "newPanel" );
state( element, 0, 1, 0 );
});
- anchors.eq( 1 ).click();
+ anchors.eq( 1 ).trigger( "click" );
state( element, 0, 1, 0 );
// collapsing
event.preventDefault();
state( element, 0, 0, 1, 0, 0 );
});
- element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 3 ).click();
+ element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 3 ).trigger( "click" );
state( element, 0, 0, 0, 1, 0 );
// .toLowerCase() is needed to convert <P> to <p> in old IEs
equal( panel.html().toLowerCase(), "<p>testing</p>", "panel html after" );
state( element, 0, 0, 0, 0, 1 );
start();
});
- element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).click();
+ element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 4 ).trigger( "click" );
}
});
equal( element.tabs( "option", "active" ), 0 );
state( element, 1, 0, 0 );
- element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).click();
+ element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 1 ).trigger( "click" );
equal( element.tabs( "option", "active" ), 1 );
state( element, 0, 1, 0 );
equal( element.tabs( "option", "active" ), 1 );
state( element, 0, 1, 0 );
- element.find( ".ui-state-active .ui-tabs-anchor" ).click();
+ element.find( ".ui-state-active .ui-tabs-anchor" ).trigger( "click" );
equal( element.tabs( "option", "active" ), false );
state( element, 0, 0, 0 );
equal( element.tabs( "option", "active" ), 1 );
state( element, 0, 1, 0 );
- element.find( ".ui-state-active .ui-tabs-anchor" ).eq( 1 ).click();
+ element.find( ".ui-state-active .ui-tabs-anchor" ).eq( 1 ).trigger( "click" );
equal( element.tabs( "option", "active" ), 1 );
state( element, 0, 1, 0 );
state( element, 0, 1, 0 );
// ensure default click handler isn't bound
- element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 2 ).click();
+ element.find( ".ui-tabs-nav .ui-tabs-anchor" ).eq( 2 ).trigger( "click" );
equal( element.tabs( "option", "active" ), 1 );
state( element, 0, 1, 0 );
});
// Ctrl+up moves focus to the current tab
if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
event.preventDefault();
- this.active.focus();
+ this.active.trigger( "focus" );
}
},
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
- this.tabs.eq( index ).focus();
+ this.tabs.eq( index ).trigger( "focus" );
return index;
},
// Prevent users from focusing disabled tabs via click
this.tablist
- .delegate( "> li", "mousedown" + this.eventNamespace, function( event ) {
+ .on( "mousedown" + this.eventNamespace, "> li", function( event ) {
if ( $( this ).is( ".ui-state-disabled" ) ) {
event.preventDefault();
}
// We don't have to worry about focusing the previously focused
// element since clicking on a non-focusable element should focus
// the body anyway.
- .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+ .on( "focus" + this.eventNamespace, ".ui-tabs-anchor", function() {
if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
this.blur();
}
this.tablist
.removeAttr( "role" )
- .unbind( this.eventNamespace );
+ .off( this.eventNamespace );
this.anchors
.removeAttr( "role tabIndex" )