 
   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()



  getDropTargetIndex: (event) ->
    target = event.target
    tabBar = target.closest('.tab-bar')

    return if @isPlaceholder(target)

    sortables = @getTabs()
    element = @tabForElement(target)
    element ?= sortables[sortables.length - 1]

    return 0 unless element?
