I have many elements that one of my JS widgets needs to create and add to the DOM often. They never change.
So one option would be to store the HTML itself as a stri
You can try doing an AJAX fetch of the static HTML block instead of storing it in the page itself. It allows you to be more flexible with what kind of block you want to insert in the future as well.
Alternatively (this is just a random idea which and not very well fleshed out), you can store the "structure" as JSON data and then dynamically parse it. Possibly something like {"div": {"div": {"span": "Text here"}}}
for
. I'd still go with AJAX though. :)