         range = null
       )
     )
-    @ignoreDomChanges = false
+    @ignoreDomChanges = oldIgnoreDomChange
 
   insertNewlineAt: (startIndex) ->
     range = new Tandem.Range(this, startIndex, startIndex)

      div.appendChild(node)
      node = nextSibling

  deleteAt: (startIndex, length) ->  
    @ignoreDomChanges = true
    range = if _.isNumber(startIndex) then new Tandem.Range(this, startIndex, startIndex + length) else startIndex
    this.preserveSelection(range.start, 0 - length, =>

  # applyAttribute: (TandemRange range, Object attribute) ->
  # applyAttribute: (Number startIndex, Number length, Object attribute) ->
  applyAttribute: (startIndex, length, attributes, emitEvent = true) ->
    oldIgnoreDomChange = @ignoreDomChanges
    @ignoreDomChanges = true
    if !_.isNumber(startIndex)
      [range, attributes] = [startIndex, length]
      startIndex = range.start.getIndex()
      length = range.end.getIndex() - startIndex
    else
      range = new Tandem.Range(this, startIndex, startIndex + length)
    this.preserveSelection(range.start, 0, =>
      for attr,value of attributes
        range.splitEnds()
        _.each(range.groupNodesByLine(), (nodes) =>
          return if nodes.length == 0
