File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -775,20 +775,30 @@ if ( $.uiBackCompat !== false ) {
775
775
li . addClass ( "ui-state-default ui-corner-top" ) . data ( "destroy.tabs" , true ) ;
776
776
li . find ( "a" ) . attr ( "aria-controls" , id ) ;
777
777
778
+ var doInsertAfter = index >= this . lis . length ;
779
+
778
780
// try to find an existing element before creating a new one
779
781
var panel = this . element . find ( "#" + id ) ;
780
782
if ( ! panel . length ) {
781
783
panel = this . _createPanel ( id ) ;
784
+ if ( doInsertAfter ) {
785
+ if ( index > 0 ) {
786
+ panel . insertAfter ( this . panels . eq ( - 1 ) ) ;
787
+ } else {
788
+ panel . appendTo ( this . element ) ;
789
+ }
790
+ } else {
791
+ panel . insertBefore ( this . panels [ index ] ) ;
792
+ }
782
793
}
783
794
panel . addClass ( "ui-tabs-panel ui-widget-content ui-corner-bottom" ) . hide ( ) ;
784
795
785
- if ( index >= this . lis . length ) {
796
+ if ( doInsertAfter ) {
786
797
li . appendTo ( this . list ) ;
787
- panel . appendTo ( this . list [ 0 ] . parentNode ) ;
788
798
} else {
789
799
li . insertBefore ( this . lis [ index ] ) ;
790
- panel . insertBefore ( this . panels [ index ] ) ;
791
800
}
801
+
792
802
options . disabled = $ . map ( options . disabled , function ( n ) {
793
803
return n >= index ? ++ n : n ;
794
804
} ) ;
You can’t perform that action at this time.
0 commit comments