   # Return a given range of the rendered value of a part of the dom.
   # If path is not given, the default path is used.
   getContentForRange: (start, end, path = null) ->
-    @getContentForPath(path).substr start, end - start
+    text = @getContentForPath(path).substr start, end - start
+    text.trim()
 
   # Get the context that encompasses the given text range
   # in the rendered text of the document

    content = pathInfo?.content

    if not content? or content is ""
      # node has no content            
#      console.log "No content, returning"
      return index
        
    startIndex = if parentContent? then (parentContent.indexOf content, index) else index

    # A: I seem to remember that the answer is yes, but I don't remember why.
    if node.hasChildNodes()
      for child in node.childNodes
        @collectPathsForNode child, invisible, verbose
    null

  getBody: -> (@rootWin.document.getElementsByTagName "body")[0]
