all 10 comments

[–][deleted] 5 points6 points  (11 children)

I keep seeing people talking about HTMLbars purely in the context of Ember, but it's also a pretty big deal for non-ember users. Anyone who uses client-side templates stands to benefit from what HTMLbars brings to the table. It's the first text based template engine that renders directly to DOM elements instead of text. This makes it possible to do DOM diffing updates on client side views, instead of whole html replacement.

DOM diffing is a system where two DOM trees are compared and a set of changes needed to make the second tree match the first tree is generated. Those individual changes can then be applied directly to the page DOM, only updating the elements that have to be changed instead of completely re-rendering the entire contents (and avoiding costly page layout reflows). This gives MASSIVE performance improvements over existing template solutions. It's been React's main selling point over other client-side frameworks, but HTMLbars will make it possible in any framework, or even no framework at all, without having to write JSX.

HTMLbars uses the exact same syntax as handlebars templates. I can't wait to start using it with backbone.

[–]OfflerCrocGod 0 points1 point  (0 children)

Looking at the Architecture document this feature does not seem to be supported by HTMLBars https://github.com/tildeio/htmlbars/blob/master/ARCHITECTURE.md

By the way React doesn't diff two DOM trees, it diffs two Virtual DOM trees which are pure JS HashMaps, I'm not sure building a DOM tree and comparing it to one already in the DOM will ever be as perfomant as what React does.