UI Tabs: allow initializing an empty list, fixes #3683

This commit is contained in:
Klaus Hartl 2009-01-10 12:35:01 +00:00
parent 71a97f2561
commit db738053ca

View File

@ -150,7 +150,7 @@ $.widget("ui.tabs", {
// highlight selected tab
this.$panels.addClass(o.hideClass);
this.$lis.removeClass(o.selectedClass);
if (o.selected !== null) {
if (o.selected !== null && this.$tabs.length) { // check for length avoids error when initializing empty list
this.$panels.eq(o.selected).removeClass(o.hideClass);
var classes = [o.selectedClass];
if (o.deselectable) classes.push(o.deselectableClass);