How to avoid duplicate rendering of DOM elements in jsrender
问题 is it possible to check for duplicate Dom elements while rendering a jsrender.template? For example: if element doesnt exists use this: <li id="liv_{{:nid}}"> <div class="qwqw"><a href="#"></a></div> <div class=""> <p class="we">{{:spd}} <span>mph (todo)</span></p> </div> <div class="clear"></div> </li> if the element "liv1" exists then update the view and dont perform step 1. 回答1: Try to use helper functions Templates pseudo code: {{if ~domElementExists(id)}} ... {{/if}} Helper's pseudo code