         nodes.push(node)
 
     nodes
+
+  getBlockCount: ->
+    walker = DOM.walkTree(@element)
+    blockCount = 0
+
+    while walker.nextNode()
+      node = walker.currentNode
+      blockCount++ if nodeIsBlockStartComment(node)
+
+    blockCount
 
   getLocationRangeAtPoint: ([clientX, clientY]) ->
     if document.caretPositionFromPoint

        else if not node
          node = currentNode
          nodeOffset = offset
      offset += length
      break if offset > location.offset

    [node, nodeOffset]

  getNodesForIndex: (index) ->
    nodes = []

    [container, offset]

  findNodeAndOffsetForLocation: (location) ->
    index = Math.min(location.index, @getBlockCount())
    offset = 0

    for currentNode in @getNodesForIndex(index)
      length = nodeLength(currentNode)
      lastNode = currentNode
      lastOffset = offset

      if location.offset <= offset + length
        if currentNode.nodeType is Node.TEXT_NODE
          node = currentNode
