 
   isPlaceholder: (element) ->
     element.classList.contains('placeholder')
-
-  getTabBar: (target) ->
-    if target.classList.contains('tab-bar')
-      target
-    else
-      closest(target, '.tab-bar')
 
   onMouseEnter: ->
     for tab in @getTabs()

  removeTabForItem: (item) ->
    tabIndex = @tabs.findIndex((t) -> t.item is item)
    if tabIndex isnt -1
      @tabs[tabIndex].destroy()
      @tabs.splice(tabIndex, 1)
    tab.updateTitle() for tab in @getTabs()
    @updateTabBarVisibility()


  onMouseDown: (event) ->
    return unless matches(event.target, ".tab")

    tab = @tabForElement(event.target)
    if event.which is 3 or (event.which is 1 and event.ctrlKey is true)
      @rightClickedTab?.classList.remove('right-clicked')
      @rightClickedTab = tab
