     @blockElements = []
     @processedElements = []
 
-  parse: ->
+  getDocument: ->
+    Trix.Document.fromJSON(@blocks)
+
+  parse: benchmark "HTMLParser#parse", ->
     try
       @createHiddenContainer()
       html = sanitizeHTML(@html)

  appendBlockForElement: (element) ->
    if @isBlockElement(element) and not @isBlockElement(element.firstChild)
      attributes = getBlockAttributes(element)
      unless elementContainsNode(@currentBlockElement, element) and arraysAreEqual(attributes, @currentBlock.getAttributes())
        @currentBlock = @appendBlockForAttributes(attributes, element)
        @currentBlockElement = element


    dimensions.width = parseInt(width, 10) if width
    dimensions.height = parseInt(height, 10) if height
    dimensions
