I do not think this is a good idea, any suggestion?
You’ve said you’re using Prototype. You could make use of its
For instance, here’s a Prototype template for building a table row:
You have various options for where and how to store the template text:
In all three of those cases, eventually you end up with a string containing the template text, e.g.:
From the string, you make a template:
And then use it:
Note that (sadly) you do have to do the HTML escaping yourself (because Prototype’s templates aren’t specifically tied to HTML, you can use them for any situation where you have a templated string). Or you can make a fairly small change to the