Templating with DOM

DOMTemplate is a new templating system that doesn't use any markup. What you do is create an HTML document with all the elements you want, then use it to produce a subset of the elements, perhaps with repeated elements, stuffed with your data. It's based on this ranty post.

I wish it were doing as well as Mustache.

Having written up some experimental code to do html forms with DOM manipulation, I'm all for DOM based templating on the server side. DOM Templating even uses a syntax similar to jQuery for its selectors, so porting to a node.js and jQuery environment would be feasible.

This tech's been around for several years, but it never really took off. I have to wonder why. My motivation was to deal with forms, which, for HTML, is pretty busy; there are a lot of attributes in the code. That's not so much the case with regular layout, though. CSS is making regular layout simpler.

Down in the comments on the Ian Dooley blog, there's a reference to another DOM manipulator called diazo. It takes a layout and merges it with an existing website's layout, by using XSLT to perform the merge.