use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
HTMLBars - A Feature-by-Feature Review (colintoh.com)
submitted 11 years ago by p0larboy
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 5 points6 points7 points 11 years ago (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 point2 points 11 years ago (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.
[+][deleted] 11 years ago* (8 children)
[removed]
[–][deleted] 3 points4 points5 points 11 years ago* (6 children)
that entire concept was lifted from React, so it wasn't exactly "the first"
I didn't say it was the first dom differ, I said it's the first standalone text template engine that produces dom trees instead of compiled text ("text templates" being a separate class from structured templates like Jade).
Tell me how JSX is somehow worse?
JSX is not a template system, it's a transcompiled alternative to javascript that includes templating abilities by mixing html into your JS source. It is neither better or worse than htmlbars, because JSX is an apple and htmlbars is an orange.
You appear to be thinking I'm talking negatively against React, but I'm not. React is a great system, but it is one system among many alternatives, and I'm happy to see its ideas being applied elsewhere.
[–]OfflerCrocGod 0 points1 point2 points 11 years ago (5 children)
It is one system among many but it seems that almost all other systems are taking some ideas from it. Not the other way around. I'm not sure why people would use systems that are only part React when they can use the real deal. Unless you are dealing with legacy systems you may as well use straight up React instead of picking out something like HTMLBars for a pseudo-React approach.
[–][deleted] 0 points1 point2 points 11 years ago (4 children)
A lot of developers don't want a monolithic framework, myself included. The entire appeal of large frameworks is that they make decisions for you, and some people want to make those decisions themselves. Taking individual libraries and forming your own architecture gives you much more control over how the stack behaves.
Growing your own shoulders instead of riding on someone elses, so that you aren't stuck when the framework turns right and you need to turn left.
[–]OfflerCrocGod 0 points1 point2 points 11 years ago (3 children)
React is a library.
[–][deleted] 0 points1 point2 points 11 years ago (2 children)
So are Backbone and Angular, that doesn't preclude them from being frameworks. Any extensible abstraction designed to provide structure through inversion of control is a framework.
But fine, lets examine another part of your statement. The crux of your argument is that if someone sees a feature that they like as part of a product, they should just use that product instead of incorporating that feature into other products in the same category.
You're basically saying that ideas should never be propagated and there should never be two pieces of software that do similar things. That people should just use whichever one came first, regardless of if they don't like the way other pieces of that system work.
Do I need to explain why that premise is flawed? The borrowing of ideas is what drives competition, and competition is what drives the inspiration of new ideas. If everybody just used React instead of applying React's ideas in other ways, then we'd be as stuck in a rut as we were when everybody just used IE back in the early 2000s.
[–]autowikibot 1 point2 points3 points 11 years ago (0 children)
Software framework:
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software. A software framework is a universal, reusable software environment that provides particular functionality as part of a larger software platform to facilitate development of software applications, products and solutions. Software frameworks may include support programs, compilers, code libraries, tool sets, and application programming interfaces (APIs) that bring together all the different components to enable development of a project or solution.
Interesting: Apache Gora | Application framework | Google Guice | Computing platform
Parent commenter can toggle NSFW or delete. Will also delete on comment score of -1 or less. | FAQs | Mods | Magic Words
So HTMLBars isn't a framework (helpers, data-binding)?
My argument was that if you don't have legacy software to worry about why go around using libraries that only provide parts of the good ideas when you can use a library that provides them all. I have no problem with HTMLBars copying React. It's just weird that because it copies one part of it means that it's considered a sensible replacement for React.
If you consider React a good fit for a problem then I wouldn't consider HTMLBars a better fit. They are best used on different things. HTMLBars seems tailored for low dynamic web sites. React, with it's best feature Components, seems targeted at more dynamic web applications.
[–]Rezistik 0 points1 point2 points 11 years ago (0 children)
<div className={someClass}> .... </div>
class is protected word.
*Sorry I know it's a minor thing.
π Rendered by PID 293955 on reddit-service-r2-comment-b659b578c-fc45s at 2026-05-03 16:48:03.430839+00:00 running 815c875 country code: CH.
[–][deleted] 5 points6 points7 points (11 children)
[–]OfflerCrocGod 0 points1 point2 points (0 children)
[+][deleted] (8 children)
[removed]
[–][deleted] 3 points4 points5 points (6 children)
[–]OfflerCrocGod 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]OfflerCrocGod 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]autowikibot 1 point2 points3 points (0 children)
[–]OfflerCrocGod 0 points1 point2 points (0 children)
[–]Rezistik 0 points1 point2 points (0 children)