         position = container.trixPosition
       else
         node = container.childNodes[offset - 1]
-        walker = Trix.DOM.createTreeWalker(node)
+        walker = DOM.createTreeWalker(node)
         walker.lastChild()
         index = walker.currentNode.trixIndex
         position = walker.currentNode.trixPosition + walker.currentNode.trixLength


  rangeWithinElement: (range) ->
    if range.collapsed
      Trix.DOM.within(@element, range.startContainer)
    else
      Trix.DOM.within(@element, range.startContainer) and Trix.DOM.within(@element, range.endContainer)

  findLocationFromContainerAtOffset: (container, offset) ->
    if container.nodeType is Node.TEXT_NODE

    [container, offset]

  findNodeForLocationRange: (range) ->
    walker = DOM.createTreeWalker(@element, null, nodeFilterForLocationRange)
    node = walker.currentNode

    while walker.nextNode()
