From e3f94a87dc312c2225e9ebe7231d868820bd6150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Feb 2015 14:55:25 -0500 Subject: [PATCH 1/2] 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. --- demos/tabs/ajax.html | 2 +- ui/tabs.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/demos/tabs/ajax.html b/demos/tabs/ajax.html index ba766dd298d..7a486fc9635 100644 --- a/demos/tabs/ajax.html +++ b/demos/tabs/ajax.html @@ -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." ); diff --git a/ui/tabs.js b/ui/tabs.js index 71c60761d21..75f56d9e322 100644 --- a/ui/tabs.js +++ b/ui/tabs.js @@ -835,7 +835,7 @@ return $.widget( "ui.tabs", { panel.attr( "aria-busy", "true" ); this.xhr - .success(function( response ) { + .done(function( response ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { @@ -843,7 +843,7 @@ return $.widget( "ui.tabs", { that._trigger( "load", event, eventData ); }, 1 ); }) - .complete(function( jqXHR, status ) { + .always(function( jqXHR, status ) { // support: jQuery <1.8 // http://bugs.jquery.com/ticket/11778 setTimeout(function() { From 4d0ceaf62f7f6a127b7c9e47fbe56e6451b04e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 23 Feb 2015 15:24:39 -0500 Subject: [PATCH 2/2] [fixup]: Handle different signatures --- ui/tabs.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/ui/tabs.js b/ui/tabs.js index 75f56d9e322..8e5f0e58d17 100644 --- a/ui/tabs.js +++ b/ui/tabs.js @@ -818,6 +818,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 @@ -835,28 +847,21 @@ return $.widget( "ui.tabs", { panel.attr( "aria-busy", "true" ); this.xhr - .done(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 ); }) - .always(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 ); }); }