]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: Properly remove generated aria-controls attributes on destroy.
authorScott González <scott.gonzalez@gmail.com>
Tue, 29 May 2012 21:55:24 +0000 (17:55 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 30 May 2012 12:01:02 +0000 (08:01 -0400)
ui/jquery.ui.tabs.js

index 79587bba638b92bbe01f772f859d27e508330f38..a64dca6e4a6e76826e59e4b7d40a9b08f1111190 100644 (file)
@@ -247,7 +247,9 @@ $.widget( "ui.tabs", {
                        if ( panel.length) {
                                that.panels = that.panels.add( panel );
                        }
-                       tab.attr( "aria-controls", selector.substring( 1 ) );
+                       tab
+                               .data( "ui-tabs-aria-controls", tab.attr( "aria-controls" ) )
+                               .attr( "aria-controls", selector.substring( 1 ) );
                });
        },
 
@@ -488,8 +490,17 @@ $.widget( "ui.tabs", {
                                        "ui-tabs-panel",
                                        "ui-widget-content",
                                        "ui-corner-bottom"
-                               ].join( " " ) )
-                               .removeAttr( "aria-controls" );
+                               ].join( " " ) );
+                       }
+               });
+
+               this.lis.each(function() {
+                       var li = $( this ),
+                               prev = li.data( "ui-tabs-aria-controls" );
+                       if ( prev ) {
+                               li.attr( "aria-controls", prev );
+                       } else {
+                               li.removeAttr( "aria-controls" );
                        }
                });