DOM-based templating is a horrible idea, at least for the majority of projects I've ever worked on.<p>The whole point of using templates is to separate your presentation logic from the rest of your application - ideally, you can hand the templates over to a client-side developer/designer and they can re-jiggle everything on their own.<p>If your templating code works by performing manipulations against a DOM, even minor changes to your page structure require to to completely rewrite both the templates and the code that manipulates them. I'd much rather leave my "view" code alone and just alter the template.
The fact that it's all std-based, and back/front-end rendered is beautiful, but what seriously bothers me is how much weld.js is tied to jQuery.<p>The README states "Use with whatever library you want, jQuery for example". Let's analyze that for a second.<p>Weld.js uses the following jQuery methods:
- Sizzle selector ($)
- first()
- is()
- val()
- attr()
- text()
- map()
- extend()
- clone()
- data()
- remove()<p>These methods are used throughout the 249 lines of code.<p>This makes weld.js completely dependent on jQuery. Thus, you <i>can't</i> just use whatever library you want. And that would be allright, if the README would say that; but it didn't, and so it isn't.
<a href="http://www.yuiblog.com/blog/2010/09/29/video-glass-node/" rel="nofollow">http://www.yuiblog.com/blog/2010/09/29/video-glass-node/</a> This video from David Glass shows why this can be very powerful when code on the front end and the backend. It's pretty straight forward. Check for content. If not generate content. Attach behavior (skipped on the server). render out put (the branch between the server and the front end).<p>There is an example using express and all kinds of cool business.
The Enlive system (for Clojure, see <a href="https://github.com/cgrand/enlive" rel="nofollow">https://github.com/cgrand/enlive</a>) does something very similar.
My attempt at the same idea using jquery: <a href="https://github.com/jlsync/jlt/blob/master/jlt.js" rel="nofollow">https://github.com/jlsync/jlt/blob/master/jlt.js</a><p>Anyone have any pointers to other/better similar solutions?