     node = el
 
     sel = window.getSelection()
-    offset = @lineOffset(el, sel.focusNode, sel.focusOffset)
+    if sel.type == 'None'
+      offset = 0
+    else
+      offset = @lineOffset(el, sel.focusNode, sel.focusOffset)
+
     cursor = new Editor.Cursor(offset)
 
     lines = @parse(@cloneNodesFrom(node))


    if line?
      sel = window.getSelection()
      offset = @lineOffset(line, sel.focusNode, sel.focusOffset)
      cursor = new Editor.Cursor(offset)

      lines = @parse(@cloneNodesFrom(line))

    walker = @walker(node)

    sel = window.getSelection()
    if sel.type == 'None'
      offset = 0
    else
      offset = @lineOffset(node, (sel.focusNode || node), sel.focusOffset)

    if node.previousElementSibling?
      node = node.previousElementSibling
