From 4866182deefdd06598b65fc79c6b8e7df05a54e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Mon, 11 Jun 2012 10:43:04 -0400 Subject: [PATCH] Tabs: jQuery <1.7.2 treats .data() as a getter if the value to set is undefined. --- ui/jquery.ui.tabs.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index a5d4730c5..5b9a6667b 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -384,7 +384,8 @@ $.widget( "ui.tabs", { this.anchors.each(function( i, anchor ) { var selector, panel, panelId, anchorId = $( anchor ).uniqueId().attr( "id" ), - tab = $( anchor ).closest( "li" ); + tab = $( anchor ).closest( "li" ), + originalAriaControls = tab.attr( "aria-controls" ); // inline tab if ( isLocal( anchor ) ) { @@ -405,12 +406,13 @@ $.widget( "ui.tabs", { if ( panel.length) { that.panels = that.panels.add( panel ); } - tab - .data( "ui-tabs-aria-controls", tab.attr( "aria-controls" ) ) - .attr({ - "aria-controls": selector.substring( 1 ), - "aria-labelledby": anchorId - }); + if ( originalAriaControls ) { + tab.data( "ui-tabs-aria-controls", originalAriaControls ); + } + tab.attr({ + "aria-controls": selector.substring( 1 ), + "aria-labelledby": anchorId + }); panel.attr( "aria-labelledby", anchorId ); }); -- 2.39.5