|
|
|
|
|
by tchvil
5236 days ago
|
|
The DOM is a live object while a string can be sliced and compiled in a function. If you run a template once, either to generate a form or a simple list, the DOM is faster than innerHTML. But if you need to repeat a template(loop), use partials or recurse, interpreted DOM manipulations will become a degree of magnitude slower than a compiled function concatenating strings. Quickly slow enough to loose the snappy effect of client templating. |
|
You can also use cloneNode to cache frequently reused DOM snippets.