         origParent = node.parentNode
 
       path = xpath.fromNode(origParent, root)
-      textNodes = getTextNodes(origParent)
+      textNodes = getNodes(origParent, isTextNode)
 
       # Calculate real offset as the combined length of all the
       # preceding textNode siblings. We include the length of the

    }


# Split a TextNode at an offset, returning the successor.
# https://github.com/Raynos/DOM-shim/issues/11
splitText = (node, offset) ->

  return insertAfter(tail, node)


# Predicate for checking if a node is a TextNode.
isTextNode = (node) ->
  return node.nodeType is TEXT_NODE
