       # Target the string index of the last character inside the range.
       if p is 'end' then targetOffset -= 1
 
-      for tn in getNodes(node, isTextNode)
+      for tn in filterNode(node, isTextNode)
         if (length + tn.nodeValue.length > targetOffset)
           range[p + 'Container'] = tn
           range[p + 'Offset'] = this[p + 'Offset'] - length

    if fn(node) then result.push(node)
    return node isnt last

  some(root, collect)

  return result


        origParent = node.parentNode

      path = xpath.fromNode(origParent, root)
      textNodes = filterNode(origParent, isTextNode)

      # Calculate real offset as the combined length of all the
      # preceding textNode siblings. We include the length of the
