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 gh-1455
(cherry picked from commit c1dfb98d45)
This commit is contained in:
Scott González 2015-02-23 14:55:25 -05:00
parent ddc1b32a45
commit 1c92d68c04
2 changed files with 18 additions and 13 deletions

View File

@ -13,7 +13,7 @@
$(function() {
$( "#tabs" ).tabs({
beforeLoad: function( event, ui ) {
ui.jqXHR.error(function() {
ui.jqXHR.fail(function() {
ui.panel.html(
"Couldn't load this tab. We'll try to fix this as soon as possible. " +
"If this wouldn't be a demo." );

View File

@ -817,6 +817,18 @@ return $.widget( "ui.tabs", {
eventData = {
tab: tab,
panel: panel
},
complete = function( jqXHR, status ) {
if ( status === "abort" ) {
that.panels.stop( false, true );
}
tab.removeClass( "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
delete that.xhr;
}
};
// not remote
@ -834,28 +846,21 @@ return $.widget( "ui.tabs", {
panel.attr( "aria-busy", "true" );
this.xhr
.success(function( response ) {
.done(function( response, status, jqXHR ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
panel.html( response );
that._trigger( "load", event, eventData );
complete( jqXHR, status );
}, 1 );
})
.complete(function( jqXHR, status ) {
.fail(function( jqXHR, status ) {
// support: jQuery <1.8
// http://bugs.jquery.com/ticket/11778
setTimeout(function() {
if ( status === "abort" ) {
that.panels.stop( false, true );
}
tab.removeClass( "ui-tabs-loading" );
panel.removeAttr( "aria-busy" );
if ( jqXHR === that.xhr ) {
delete that.xhr;
}
complete( jqXHR, status );
}, 1 );
});
}