   # it doesn't sit on top of horizontal scrollbars like Chrome's HUD does.
 
   init: (focusable = true) ->
-    @hudUI ?= new UIComponent "pages/hud.html", "vimiumHUDFrame", ({data}) => this[data.name]? data
+    @hudUI ?= new UIComponent "pages/hud.html", "vimiumHUDFrame", ({data}) =>
+      if (this[data.name])
+        this[data.name](data)
+      # this[data.name]? data
     @tween ?= new Tween "iframe.vimiumHUDFrame.vimiumUIComponentVisible", @hudUI.shadowDOM
     if focusable
       @hudUI.toggleIframeElementClasses "vimiumNonClickable", "vimiumClickable"


    focusNode = DomUtils.getSelectionFocusElement()
    document.activeElement?.blur()
    focusNode?.focus?()

    if exitEventIsEnter
      FindMode.handleEnter()

    DomUtils.documentComplete =>
      @init()
      @hudUI.postMessage {name: "copyToClipboard", data: text}
      return
    return

  pasteFromClipboard: (@pasteListener) ->
    DomUtils.documentComplete =>
      @init()
      @tween.fade 0, 0
      @hudUI.postMessage {name: "pasteFromClipboard"}
      return
    return

  pasteResponse: ({data}) ->
    # Hide the HUD frame again.
    @hudUI.toggleIframeElementClasses "vimiumUIComponentVisible", "vimiumUIComponentHidden"
    @unfocusIfFocused()
    @pasteListener data
    return

  unfocusIfFocused: ->
    # On Firefox, if an <iframe> disappears when it's focused, then it will keep "focused",
    # which means keyboard events will always be dispatched to the HUD iframe
    if @hudUI && @hudUI.showing
      @hudUI.iframeElement.blur()
      window.focus()
    return

class Tween
  opacity: 0
