Hacker News new | ask | show | jobs
by eatonphil 1798 days ago
Showing the difference between markup/scripting a single static element is pretty different from applications where you have to display lists of things with other lists of things inside. If you only have static elements then just writing it in HTML and making it dynamic with JavaScript is fine.

But once you have to display lists of stuff with lists of other stuff inside you basically need a template library otherwise you're going to be doing some pretty weird DOM manipulation to copy sections of elements.

So a comparison that might resonate better with folks here might be to have a pure JS TODO app with a comment section in each list item. It becomes harder to express in pure HTML. You'll want some template library to keep it maintainable.

1 comments

Template on the server?

If your lists are long enough, you probably want to split what you can actually display from the rest of the list, because even today updating the DOM with thousands of nodes is expensive. And doing seems to be easier and less chatty to do on the front-end I think.

Sure templates on the server are fine too I just mean that the comparison is more compelling when describing the things that prompt templates in the first place (whether on the server or frontend).