diff options
author | Scott González <scott.gonzalez@gmail.com> | 2015-02-23 14:55:25 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2015-02-24 10:24:58 -0500 |
commit | c1dfb98d4576901aacf35f99d2506e8f652c2690 (patch) | |
tree | b42299ce89bedfb437433d48fcdf5f1a636331ce /ui/tabs.js | |
parent | 962e05dc1d0a51a7458bc44725417aa3462cd89a (diff) | |
download | jquery-ui-c1dfb98d4576901aacf35f99d2506e8f652c2690.tar.gz jquery-ui-c1dfb98d4576901aacf35f99d2506e8f652c2690.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
Diffstat (limited to 'ui/tabs.js')
-rw-r--r-- | ui/tabs.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/ui/tabs.js b/ui/tabs.js index 71c60761d..8e5f0e58d 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 - .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 ); }); } |