 
     attributes
 
-  getBlockAttributes = (element) ->
+  getBlockAttributes: (element) ->
     attributes = []
-    while element
+    while element and element isnt @container
       for attribute, config of Trix.config.blockAttributes when config.parse isnt false
         if tagName(element) is config.tagName
           if config.test?(element) or not config.test

      switch tagName(element)
        when "br"
          unless @isExtraBR(element) or @isBlockElement(element.nextSibling)
            @appendStringWithAttributes("\n", getTextAttributes(element))
          @processedElements.push(element)
        when "img"
          attributes = url: element.src, contentType: "image"
          attributes[key] = value for key, value of getImageDimensions(element)
          @appendAttachmentWithAttributes(attributes, getTextAttributes(element))
          @processedElements.push(element)
        when "tr"
          unless element.parentNode.firstChild is element

    else
      text.unshift(pieceForString(string))

  getTextAttributes: (element) ->
    attributes = {}
    for attribute, config of Trix.config.textAttributes
      if config.parser
