Tabs: Remove core event/alias and deprecated module dependencies

This commit is contained in:
Alexander Schmitz 2015-05-13 22:01:58 -04:00
parent 89bf0d057b
commit c25a541fc4
4 changed files with 17 additions and 17 deletions

View File

@ -48,7 +48,7 @@
});
// 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();
@ -70,18 +70,18 @@
// 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();

View File

@ -85,7 +85,7 @@ test( "beforeActivate", function() {
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
@ -156,7 +156,7 @@ test( "activate", function() {
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
@ -251,7 +251,7 @@ test( "beforeLoad", function() {
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" );
@ -315,7 +315,7 @@ asyncTest( "load", function() {
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" );
}
});

View File

@ -68,7 +68,7 @@ test( "{ active: Number }", function() {
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 );
@ -127,7 +127,7 @@ test( "collapsible", function( assert ) {
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 );
@ -146,7 +146,7 @@ test( "collapsible", function( assert ) {
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 );
@ -210,7 +210,7 @@ test( "{ event: null }", function() {
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 );
});

View File

@ -233,7 +233,7 @@ $.widget( "ui.tabs", {
// 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" );
}
},
@ -271,7 +271,7 @@ $.widget( "ui.tabs", {
_focusNextTab: function( index, goingForward ) {
index = this._findNextTab( index, goingForward );
this.tabs.eq( index ).focus();
this.tabs.eq( index ).trigger( "focus" );
return index;
},
@ -394,7 +394,7 @@ $.widget( "ui.tabs", {
// 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();
}
@ -406,7 +406,7 @@ $.widget( "ui.tabs", {
// 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();
}
@ -726,7 +726,7 @@ $.widget( "ui.tabs", {
this.tablist
.removeAttr( "role" )
.unbind( this.eventNamespace );
.off( this.eventNamespace );
this.anchors
.removeAttr( "role tabIndex" )