 
     if not contains(bounds, @start)
       node = bounds
-      next = (node) -> node isnt last and preFirst(node) or null
+      next = (node) -> node isnt last and documentForward(node) or null
       last = lastLeaf(bounds)
       node = next(node) while not isTextNode(node)
       @start = node
 
     if not contains(bounds, @end)
       node = bounds
-      next = (node) -> node isnt last and preLast(node) or null
+      next = (node) -> node isnt last and documentReverse(node) or null
       last = firstLeaf(bounds)
       node = next(node) while not isTextNode(node)
       @end = node

      return true

    # Find the start TextNode.
    # The guarantees above provide that a pre-order traversal visits every
    # Node in the Range before visiting the last leaf of the end container.
    node = startContainer
    next = (node) -> node isnt last and preFirst(node) or null
    last = lastLeaf(endContainer)
    node = next(node) while not isTextNodeInRange(node)
    start = node

    # Find the end TextNode.
    # Similarly, a reverse pre-order traversal visits every Node in the Range
    # before visiting the first leaf of the start container.
    node = endContainer
    next = (node) -> node isnt last and preLast(node) or null
    last = firstLeaf(startContainer)
    node = next(node) while not isTextNodeInRange(node)
    end = node

  return node.nodeType is TEXT_NODE


# Return the next Node in a document order traversal.
# This order is equivalent to a classic pre-order.
documentForward = (node) ->
  if node.firstChild?
    return node.firstChild

