     else if @currentBlockElement and not elementContainsNode(@currentBlockElement, element) and not @isBlockElement(element)
         @currentBlock = @appendBlockForAttributes({})
         @currentBlockElement = null
+
+  isExtraBR: (element) ->
+    return unless tagName(element) is "br"
+
+    previousSibling = element.previousElementSibling
+    nextSibling = element.nextElementSibling
+    isLastChild = not nextSibling
+    isOnlyChild = isLastChild and not previousSibling
+    previousSiblingIsBR = tagName(previousSibling) is "br"
+    parentIsBlock = @isBlockElement(element.parentNode)
+
+    parentIsBlock and (isOnlyChild or (isLastChild and previousSiblingIsBR))
 
   isBlockElement: (element) ->
     return unless element?.nodeType is Node.ELEMENT_NODE

    else
      switch tagName(element)
        when "br"
          unless isExtraBR(element)
            @appendStringWithAttributes("\n", getTextAttributes(element))
          @processedElements.push(element)
        when "img"


    body.innerHTML

  getBlockElementMargin = (element) ->
    style = window.getComputedStyle(element)
    if style.display is "block"
