3 ms·
This can work, it's just a slightly more complex programming model, as it couples the template population code with the DOM structure. Whereas a template is eff
by mmahemoff 14y ago
This can work, it's just a slightly more complex programming model, as it couples the template population code with the DOM structure. Whereas a template is effectively a cleanly-defined API in which you just pass it a set of key-value pairs.
DOM manipulation has traditionally been slower than innerHTML, which is another reason people might have shied away from this approach. I believe the performance gap is no longer clearcut though, so the argument may not hold for recent browsers at least.