diff options
author | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-05 19:11:12 +0000 |
---|---|---|
committer | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-02-05 19:11:12 +0000 |
commit | 78adee126cbf4ec3147f698f5bb6d71199a51b65 (patch) | |
tree | a5ff25f8db7d5736b2ee063f2ad611ecf9dff533 /ui | |
parent | 8aee174cdb1846688b7c720c50ea6c715db5f0f3 (diff) | |
download | jquery-ui-78adee126cbf4ec3147f698f5bb6d71199a51b65.tar.gz jquery-ui-78adee126cbf4ec3147f698f5bb6d71199a51b65.zip |
Tabs: removed useless array joins, consistent usage of "ui-tabs-selected" class
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.tabs.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index b80e51759..1564af841 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -156,8 +156,7 @@ $.widget("ui.tabs", { this.$lis.removeClass('ui-tabs-selected ui-state-active'); if (o.selected >= 0 && this.$tabs.length) { // check for length avoids error when initializing empty list this.$panels.eq(o.selected).removeClass('ui-tabs-hide'); - var classes = ['ui-tabs-selected ui-state-active']; - this.$lis.eq(o.selected).addClass(classes.join(' ')); + this.$lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active'); // seems to be expected behavior that the show callback is fired var onShow = function() { @@ -257,9 +256,9 @@ $.widget("ui.tabs", { // Switch a tab... function switchTab(clicked, $li, $hide, $show) { - var classes = ['ui-tabs-selected ui-state-active']; - $li.removeClass('ui-state-default').addClass(classes.join(' ')) - .siblings().removeClass(classes.join(' ')).addClass('ui-state-default'); + var classes = 'ui-tabs-selected ui-state-active'; + $li.removeClass('ui-state-default').addClass(classes) + .siblings().removeClass(classes).addClass('ui-state-default'); hideTab(clicked, $hide, $show); } @@ -273,7 +272,7 @@ $.widget("ui.tabs", { // or is already loading or click callback returns false stop here. // Check if click handler returns false last so that it is not executed // for a disabled or loading tab! - if (($li.hasClass('ui-state-active') && !o.collapsible) + if (($li.hasClass('ui-tabs-selected') && !o.collapsible) || $li.hasClass('ui-state-disabled') || $(this).hasClass('ui-tabs-loading') || self._trigger('select', null, self._ui(this, $show[0])) === false @@ -286,7 +285,7 @@ $.widget("ui.tabs", { // if tab may be closed TODO avoid redundant code in this block if (o.collapsible) { - if ($li.hasClass('ui-state-active')) { + if ($li.hasClass('ui-tabs-selected')) { o.selected = -1; if (o.cookie) self._cookie(o.selected, o.cookie); $li.removeClass('ui-tabs-selected ui-state-active') |