 
       previousAttributes = attributes
     containers
-
-  recordNodePositions: ->
-    @nodes = []
-    @positions = []
-    walker = document.createTreeWalker(@element)
-    while walker.nextNode()
-      if walker.currentNode.trixPosition?
-        @recordNode(walker.currentNode)
-
-  recordNode: (node) ->
-    @nodes.push(node)
-    @positions.push(node.trixPosition)
-    node
-
-  # Add an extra BR if the last node is one. Without the extra, the cursor won't move down.
-  appendBRelement: ->
-    if node = @nodes[@nodes.length - 1]
-      if node.tagName?.toLowerCase() is "br"
-        br = node.cloneNode(false)
-        br.trixPosition = node.trixPosition + 1
-        @element.appendChild(@recordNode(br))
 
   getSelectedRange: ->
     return @lockedRange if @lockedRange

      container.childNodes[offset]?.trixPosition ? offset

  findContainerAndOffsetForPosition: (position) ->
    if @nodes.length is 0
      [@element, 0]
    else
      index = 0
      for currentPosition, currentIndex in @positions
        break if position < currentPosition
        index = currentIndex

      node = @nodes[index]

      if node.nodeType is Node.TEXT_NODE
        [node, position - node.trixPosition]
      else
        offset = [node.parentNode.childNodes...].indexOf(node)
        [node.parentNode, offset]

  createContainer = (string, attributes, position, tagName = "span") ->
    element = document.createElement(tagName)

    selectedRange = @getSelectedRange()
    @element.innerHTML = ""
    @element.appendChild(container) for container in @createContainersForText()
    @setSelectedRange(selectedRange)

  createContainersForText: ->
