aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2015-02-23 14:55:25 -0500
committerScott González <scott.gonzalez@gmail.com>2015-03-10 12:37:14 -0400
commit1c92d68c042a493303edb48c11b3e35d62d6aff6 (patch)
treecfc31a54cc6eddb7f25efbca6c6ce4438919fd84
parentddc1b32a45746db7cc8e96de92818936464b323b (diff)
downloadjquery-ui-1c92d68c042a493303edb48c11b3e35d62d6aff6.tar.gz
jquery-ui-1c92d68c042a493303edb48c11b3e35d62d6aff6.zip
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 c1dfb98d4576901aacf35f99d2506e8f652c2690)
-rw-r--r--demos/tabs/ajax.html2
-rw-r--r--ui/tabs.js29
2 files changed, 18 insertions, 13 deletions
diff --git a/demos/tabs/ajax.html b/demos/tabs/ajax.html
index ba766dd29..7a486fc96 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 3cdcae6fc..db4c9726a 100644
--- a/ui/tabs.js
+++ b/ui/tabs.js
@@ -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 );
});
}