I am trying to use the pure.js templating engine to convert a JSON array into HTML code.
I understand how to use autoRender()
to map an associative map to HTML: http://jsfiddle.net/P7H98/
but if I replace the associative map with an array, I end up with iteration that inserts empty rows: http://jsfiddle.net/P7H98/1/
Is it possible to autoRender()
an array and end up with the same output as the first example?
UPDATE: Nesting <div class="toString"></div>
inside the <li>
node fixes the problem. But I'm still not sure why. Surely there is a more readable solution to this problem?