 
   rangeWithinElement: (range) ->
     if range.collapsed
-      Trix.DOM.within(@element, range.startContainer)
+      DOM.within(@element, range.startContainer)
     else
-      Trix.DOM.within(@element, range.startContainer) and Trix.DOM.within(@element, range.endContainer)
+      DOM.within(@element, range.startContainer) and DOM.within(@element, range.endContainer)
 
   findLocationFromContainerAtOffset: (container, offset) ->
     if container.nodeType is Node.TEXT_NODE

    [container, offset]

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

    while walker.nextNode()

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