       @classList.remove('hidden')
 
   getTabs: ->
-    tab for tab in @querySelectorAll(".tab")
+    @tabs.slice()
 
   tabAtIndex: (index) ->
-    @querySelectorAll(".tab")[index]
+    @tabs[index]
 
   tabForItem: (item) ->
-    _.detect @getTabs(), (tab) -> tab.item is item
+    @tabs.find((t) -> t.item is item)
 
   setActiveTab: (tabView) ->
     if tabView? and not tabView.classList.contains('active')

      @pane.moveItem(item, @pane.getItems().length - 1) unless @isItemMovingBetweenPanes

  moveItemTabToIndex: (item, index) ->
    if tab = @tabForItem(item)
      tab.remove()
      @insertTabAtIndex(tab, index)

  insertTabAtIndex: (tab, index) ->
    followingTab = @tabAtIndex(index) if index?
    if followingTab
      @insertBefore(tab, followingTab)
    else
      @appendChild(tab)

    tab.updateTitle()
    @updateTabBarVisibility()

  removeTabForItem: (item) ->
    @tabForItem(item)?.destroy()
    tab.updateTitle() for tab in @getTabs()
    @updateTabBarVisibility()


    @setAttribute("tabindex", -1)

  initialize: (@pane) ->
    @tabs = []
    @subscriptions = new CompositeDisposable

    @subscriptions.add atom.commands.add atom.views.getView(@pane),
