SimpleDOM perf optimization for setMorphHTML
SimpleDOM perf optimization for setMorphHTML

When running in the browser, we rely on the browser’s built-in HTML
parsing for cases when users provide unescaped HTML content as dynamic
values in their templates (i.e., `{{{unsafeHTML}}}`). Because the final
output is a DOM tree, we ask the browser to parse the HTML and turn it
into a document fragment, then insert into the appropriate location in
the rendered element.

However, for server-side rendering, the final output is serialized HTML,
not a DOM tree. In the case of raw HTML provided by the user, we’d be
doing extra work to go from raw HTML -> parsed DOM -> serialized HTML.
(That we’d need an HTML parser also adds complexity.)

This patch allows us to detect an extension to the DOM API we’ve added
to SimpleDOM that allows us to insert a node in the DOM tree that means
“raw HTML” (similar to CDATA). When we go to serialize the DOM tree, any
raw HTML nodes are written as the HTML that was provided when created.
tildeio/htmlbars,mixonic/htmlbars,tildeio/htmlbars,mixonic/htmlbars