Skip to content

Commit 1c92d68

Browse files
committed
Tabs: Use standard promise methods for jqXHR
The old success(), error() and complete() methods have been deprecated for a while and have been removed in upstream master. Closes jquerygh-1455 (cherry picked from commit c1dfb98)
1 parent ddc1b32 commit 1c92d68

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

demos/tabs/ajax.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$(function() {
1414
$( "#tabs" ).tabs({
1515
beforeLoad: function( event, ui ) {
16-
ui.jqXHR.error(function() {
16+
ui.jqXHR.fail(function() {
1717
ui.panel.html(
1818
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
1919
"If this wouldn't be a demo." );

ui/tabs.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,18 @@ return $.widget( "ui.tabs", {
817817
eventData = {
818818
tab: tab,
819819
panel: panel
820+
},
821+
complete = function( jqXHR, status ) {
822+
if ( status === "abort" ) {
823+
that.panels.stop( false, true );
824+
}
825+
826+
tab.removeClass( "ui-tabs-loading" );
827+
panel.removeAttr( "aria-busy" );
828+
829+
if ( jqXHR === that.xhr ) {
830+
delete that.xhr;
831+
}
820832
};
821833

822834
// not remote
@@ -834,28 +846,21 @@ return $.widget( "ui.tabs", {
834846
panel.attr( "aria-busy", "true" );
835847

836848
this.xhr
837-
.success(function( response ) {
849+
.done(function( response, status, jqXHR ) {
838850
// support: jQuery <1.8
839851
// http://bugs.jquery.com/ticket/11778
840852
setTimeout(function() {
841853
panel.html( response );
842854
that._trigger( "load", event, eventData );
855+
856+
complete( jqXHR, status );
843857
}, 1 );
844858
})
845-
.complete(function( jqXHR, status ) {
859+
.fail(function( jqXHR, status ) {
846860
// support: jQuery <1.8
847861
// http://bugs.jquery.com/ticket/11778
848862
setTimeout(function() {
849-
if ( status === "abort" ) {
850-
that.panels.stop( false, true );
851-
}
852-
853-
tab.removeClass( "ui-tabs-loading" );
854-
panel.removeAttr( "aria-busy" );
855-
856-
if ( jqXHR === that.xhr ) {
857-
delete that.xhr;
858-
}
863+
complete( jqXHR, status );
859864
}, 1 );
860865
});
861866
}

0 commit comments

Comments
 (0)