Skip to content

Commit

Permalink
Tabs: using closest() is shorter
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Hartl committed Feb 14, 2009
1 parent f869dab commit 26f1b03
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ui/ui.tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ $.widget("ui.tabs", {
handleState('hover', $(this));
});
this.$tabs.bind('focus.tabs blur.tabs', function() {
handleState('focus', $(this).parents('li:first'));
handleState('focus', $(this).closest('li'));
});
}

Expand Down Expand Up @@ -267,9 +267,8 @@ $.widget("ui.tabs", {

// attach tab event handler, unbind to avoid duplicates from former tabifying...
this.$tabs.bind(o.event + '.tabs', function() {
var $li = $(this).parents('li:eq(0)'),
$hide = self.$panels.filter(':visible'),
$show = $(self._sanitizeSelector(this.hash));
var $li = $(this).closest('li'), $hide = self.$panels.filter(':visible'),
$show = $(self._sanitizeSelector(this.hash));

// If tab is already selected and not collapsible or tab disabled or
// or is already loading or click callback returns false stop here.
Expand Down

0 comments on commit 26f1b03

Please sign in to comment.