     @element.setAttribute("contenteditable", "true")
     @element.setAttribute("autocorrect", "off")
     @element.setAttribute("spellcheck", "false")
+    @element.trixPosition = 0
 
   focus: ->
     @element.focus()

      node = walker.currentNode

    if node.nodeType is Node.TEXT_NODE
      [node, position - node.trixPosition]
    else
      offset = [node.parentNode.childNodes...].indexOf(node)
      [node.parentNode, offset]

  isWithin = (ancestor, element) ->
    while element

    if container.nodeType is Node.TEXT_NODE
      container.trixPosition + offset
    else
      if container.hasChildNodes()
        if container.childNodes.length is offset
          container.lastChild.trixPosition + 1
        else
          container.childNodes[offset].trixPosition
      else
        container.trixPosition

  findContainerAndOffsetForPosition: (position) ->
    return [@element, 0] if position < 1
