tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.61k stars 193 forks source link

[Question] Variable HTML content DOM cache/diff optimization? #446

Open zhuoqiang opened 8 years ago

zhuoqiang commented 8 years ago

Hi,

Not sure if I understand it correctly, AFAIK, HTMLBar/Glimmer only parse and cache the DOM structure of the Handelbars template, but not the rendered HTML itself.

Here's a special usecase to tell the difference:

<div>
{{toHTML someMarkdownContent}}
</div>

while this handlerbar template itself is simple and easy to cache/diff for glimmer, the inner html generated by {{toHTML someMarkdownContent}} maybe quite complex.

I'm wondering if the same DOM cache/diff optimization could also be applied to the dynamica HTML content generated by {{toHTML someMarkdownContent}}

In other words, right now, whatever the someMarkdownContent changes, the whole generated HTML dom need to be rerendered. Could we check the dynamica generated HTML code and only update the dom node which has changed, just like what glimmer did to handlebar template?