@@ -75,24 +75,7 @@ return $.widget( "ui.tabs", {
75
75
76
76
this . element
77
77
. addClass ( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
78
- . toggleClass ( "ui-tabs-collapsible" , options . collapsible )
79
- // Prevent users from focusing disabled tabs via click
80
- . delegate ( ".ui-tabs-nav > li" , "mousedown" + this . eventNamespace , function ( event ) {
81
- if ( $ ( this ) . is ( ".ui-state-disabled" ) ) {
82
- event . preventDefault ( ) ;
83
- }
84
- } )
85
- // support: IE <9
86
- // Preventing the default action in mousedown doesn't prevent IE
87
- // from focusing the element, so if the anchor gets focused, blur.
88
- // We don't have to worry about focusing the previously focused
89
- // element since clicking on a non-focusable element should focus
90
- // the body anyway.
91
- . delegate ( ".ui-tabs-anchor" , "focus" + this . eventNamespace , function ( ) {
92
- if ( $ ( this ) . closest ( "li" ) . is ( ".ui-state-disabled" ) ) {
93
- this . blur ( ) ;
94
- }
95
- } ) ;
78
+ . toggleClass ( "ui-tabs-collapsible" , options . collapsible ) ;
96
79
97
80
this . _processTabs ( ) ;
98
81
options . active = this . _initialActive ( ) ;
@@ -393,7 +376,26 @@ return $.widget( "ui.tabs", {
393
376
394
377
this . tablist = this . _getList ( )
395
378
. addClass ( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
396
- . attr ( "role" , "tablist" ) ;
379
+ . attr ( "role" , "tablist" )
380
+
381
+ // Prevent users from focusing disabled tabs via click
382
+ . delegate ( "> li" , "mousedown" + this . eventNamespace , function ( event ) {
383
+ if ( $ ( this ) . is ( ".ui-state-disabled" ) ) {
384
+ event . preventDefault ( ) ;
385
+ }
386
+ } )
387
+
388
+ // support: IE <9
389
+ // Preventing the default action in mousedown doesn't prevent IE
390
+ // from focusing the element, so if the anchor gets focused, blur.
391
+ // We don't have to worry about focusing the previously focused
392
+ // element since clicking on a non-focusable element should focus
393
+ // the body anyway.
394
+ . delegate ( ".ui-tabs-anchor" , "focus" + this . eventNamespace , function ( ) {
395
+ if ( $ ( this ) . closest ( "li" ) . is ( ".ui-state-disabled" ) ) {
396
+ this . blur ( ) ;
397
+ }
398
+ } ) ;
397
399
398
400
this . tabs = this . tablist . find ( "> li:has(a[href])" )
399
401
. addClass ( "ui-state-default ui-corner-top" )
@@ -711,6 +713,8 @@ return $.widget( "ui.tabs", {
711
713
. removeAttr ( "tabIndex" )
712
714
. removeUniqueId ( ) ;
713
715
716
+ this . tablist . unbind ( this . eventNamespace ) ;
717
+
714
718
this . tabs . add ( this . panels ) . each ( function ( ) {
715
719
if ( $ . data ( this , "ui-tabs-destroy" ) ) {
716
720
$ ( this ) . remove ( ) ;
0 commit comments