 
   bindWindowClick: ->
     $(window).on "click.popover." + @cid, (e) =>
-      if $(e.target).closest(@popover.selector)[0] isnt @$(@popover.selector)[0]
+      if $(e.target).closest(@uiBindings.arrow)[0] isnt @$(@uiBindings.arrow)[0]
         @hidePopover()
 
   unbindWindowClick: ->

class Backbone.Factlink.PopoverView extends Backbone.Marionette.ItemView
  popover:
    selector: '.js-popover-arrow-selector'
    popoverSelector: '.js-popover-container'

  constructor: (options) ->
    @ui ||= {}
    _.extend @ui,


    super(options)

    @bindPopover()
    @on "render", @popoverOnRender, this

  bindPopover: ->
    @$el.on "click.popover", @uiBindings.arrow, =>
      @popoverToggle()
    @$el.on "click.popover_menu", @uiBindings.container, (e) ->
      e.stopPropagation()

  popoverOnRender: ->
