@@ -792,13 +792,7 @@ $.widget( "ui.tabs", {
792
792
return ;
793
793
}
794
794
795
- this . xhr = $ . ajax ( {
796
- url : anchor . attr ( "href" ) ,
797
- beforeSend : function ( jqXHR , settings ) {
798
- return that . _trigger ( "beforeLoad" , event ,
799
- $ . extend ( { jqXHR : jqXHR , ajaxSettings : settings } , eventData ) ) ;
800
- }
801
- } ) ;
795
+ this . xhr = $ . ajax ( this . _ajaxSettings ( anchor , event , eventData ) ) ;
802
796
803
797
// support: jQuery <1.8
804
798
// jQuery <1.8 returns false if the request is canceled in beforeSend,
@@ -835,6 +829,18 @@ $.widget( "ui.tabs", {
835
829
}
836
830
} ,
837
831
832
+ // TODO: Remove this function in 1.10 when ajaxOptions is removed
833
+ _ajaxSettings : function ( anchor , event , eventData ) {
834
+ var that = this ;
835
+ return {
836
+ url : anchor . attr ( "href" ) ,
837
+ beforeSend : function ( jqXHR , settings ) {
838
+ return that . _trigger ( "beforeLoad" , event ,
839
+ $ . extend ( { jqXHR : jqXHR , ajaxSettings : settings } , eventData ) ) ;
840
+ }
841
+ } ;
842
+ } ,
843
+
838
844
_getPanelForTab : function ( tab ) {
839
845
var id = $ ( tab ) . attr ( "aria-controls" ) ;
840
846
return this . element . find ( this . _sanitizeSelector ( "#" + id ) ) ;
@@ -860,6 +866,7 @@ if ( $.uiBackCompat !== false ) {
860
866
}
861
867
} ) ;
862
868
869
+ // TODO: Remove _ajaxSettings() method when removing this extension
863
870
// ajaxOptions and cache options
864
871
$ . widget ( "ui.tabs" , $ . ui . tabs , {
865
872
options : {
@@ -879,19 +886,6 @@ if ( $.uiBackCompat !== false ) {
879
886
return ;
880
887
}
881
888
882
- $ . extend ( ui . ajaxSettings , that . options . ajaxOptions , {
883
- error : function ( xhr , s , e ) {
884
- try {
885
- // Passing index avoid a race condition when this method is
886
- // called after the user has selected another tab.
887
- // Pass the anchor that initiated this request allows
888
- // loadError to manipulate the tab content panel via $(a.hash)
889
- that . options . ajaxOptions . error ( xhr , s , ui . tab . closest ( "li" ) . index ( ) , ui . tab [ 0 ] ) ;
890
- }
891
- catch ( e ) { }
892
- }
893
- } ) ;
894
-
895
889
ui . jqXHR . success ( function ( ) {
896
890
if ( that . options . cache ) {
897
891
$ . data ( ui . tab [ 0 ] , "cache.tabs" , true ) ;
@@ -900,6 +894,23 @@ if ( $.uiBackCompat !== false ) {
900
894
} } ) ;
901
895
} ,
902
896
897
+ _ajaxSettings : function ( anchor , event , ui ) {
898
+ var ajaxOptions = this . options . ajaxOptions ;
899
+ return $ . extend ( { } , ajaxOptions , {
900
+ error : function ( xhr , s , e ) {
901
+ try {
902
+ // Passing index avoid a race condition when this method is
903
+ // called after the user has selected another tab.
904
+ // Pass the anchor that initiated this request allows
905
+ // loadError to manipulate the tab content panel via $(a.hash)
906
+ ajaxOptions . error (
907
+ xhr , s , ui . tab . closest ( "li" ) . index ( ) , ui . tab [ 0 ] ) ;
908
+ }
909
+ catch ( e ) { }
910
+ }
911
+ } , this . _superApply ( arguments ) ) ;
912
+ } ,
913
+
903
914
_setOption : function ( key , value ) {
904
915
// reset cache if switching from cached to not cached
905
916
if ( key === "cache" && value === false ) {
0 commit comments