getRenderedContents() optimizations

* Use plain text rather than HTML in TextNode
** Bypasses HTML parsing, and doesn't cause regeneration of nodes like
   appending to .innerHTML does
** We were only using HTML so we could use entities, so replace those
   with \uNNNN sequences
* Use native DOM functionality rather than jQuery
* Inline flushBuffer()

Change-Id: I7c6376b55cc0f1420a01a77b365b073fe1636263
Merge "getRenderedContents() optimizations"