Just as it's a bad habit to programmatically create HTML code in JavaScript, you should only create the minimum amount of DOM elements in your client-side JavaScript code. Fortunately, there's a templating engine available for the client side, too, and even more fortunately, the client-side templating engine has the same syntax as the server-side templates.
Using client-side QWeb templates
Getting ready
For this recipe, we will be using the my_library module from the previous recipe. We will make this more modular by moving the DOM element creation to QWeb.