* Removes tab and cleans up any children * * @param {Element} tabEl The tab element to remove
(tabEl = this.activeTabEl)
| 58 | */ |
| 59 | |
| 60 | removeTab(tabEl = this.activeTabEl) { |
| 61 | if (this.tabs.length === 1) { |
| 62 | return |
| 63 | } |
| 64 | |
| 65 | const tabIndex = tabEl.index() |
| 66 | const tabId = tabEl.remove().data('tab') |
| 67 | |
| 68 | $(`#tab-${tabId}`).remove() |
| 69 | const removedTab = this.tabs.splice(tabIndex, 1)[0] |
| 70 | removedTab.destroy() |
| 71 | |
| 72 | this.container.tabs('refresh') |
| 73 | |
| 74 | if (this.tabs.length === 1) { |
| 75 | this.hideTabBar() |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Adds a new tab |
no test coverage detected