       @checkAutocomplete()
 
     # @input.on "blur", (event) =>
-    #   console.log $(event.target)
-    #   @closeAutocomplete()
+    #   setTimeout( =>
+    #     @closeAutocomplete()
+    #   , 100)
 
   checkAutocomplete: ->
     # Open autocomplete menu if it's a word.


  registerEvents: ->
    @input.on "keyup paste input", (event) =>
      @checkAutocomplete()

      # Spans lose contenteditable attr when pasted. (!?)

      node.contentEditable = false
      node.dataset.id = id
      node.innerHTML = name
      @range.insertNode(node)
      @range.insertNode(document.createTextNode(' '));

      # Set selection range (i.e. caret position) to new token.
      range = @range.cloneRange()
      range.setStartAfter(node)
      range.collapse(true)
      sel.removeAllRanges()
