Ticket #3065: ui.tabs.js.patch

File ui.tabs.js.patch, 1023 bytes (added by wolfpakz, 14 years ago)
  • ui.tabs.js

    old new  
    361361                var o = this.options, $li = this.$lis.eq(index).remove(),
    362362                        $panel = this.$panels.eq(index).remove();
    363363
    364                 // If selected tab was removed focus tab to the right or
    365                 // in case the last tab was removed the tab to the left.
    366                 if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
    367                         this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
    368 
    369364                o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
    370365                        function(n, i) { return n >= index ? --n : n });
    371366
    372367                this.tabify();
    373368
     369    // If selected tab was removed focus tab to the right or
     370    // in case the last tab was removed the tab to the left.
     371    if ($li.hasClass(o.selectedClass) && this.$tabs.length)
     372      this.select(index + (index + 1 <= this.$tabs.length ? 0 : -1));
     373
    374374                // callback
    375375                this.element.triggerHandler('tabsremove',
    376376                        [null, this.ui($li.find('a')[0], $panel[0])], o.remove