el.js - Element/Node creation tool
github.com
github.com
But as always there are exceptions to the rule, and then this lib may come in handy.
HTML wasn't an option in something so dynamic.
I guess all I'm saying is, there are use-cases where it's fine
Another option would be to use something like mustache and precomile your templates to javascript functions which you could use.
And what about the alternatives? Yesterday (in the "The DOM isn't slow. You are." article) there was a talk about laconic and crel. Do those escape content?
[1]: https://github.com/joestelmach/laconic/blob/master/laconic.j...
[2]: https://github.com/markgandolfo/el.js/blob/master/el.js#L48
By the way, HTML encoding is fairly simple, you just have to be sure you get it right. This is a function for it that I include in most projects where I don't already have something like jQuery or laconic: https://gist.github.com/jrajav/5204669
For almost 20 years now I've seen projects like this come and go. They go because they're worthless. They might seem helpful (hey! we can use one language to do everything!) but in reality they break the cardinal rule of not using the right tool for the job.
It even hijacks the 'el' naming convention for it.
Keep at it, though! Maybe you can find a way to improve laconic, or to differentiate your own library. It's fun and a good way to learn, regardless.
That said, I think the API could be a little less verbose, but then I'm biased towards https://github.com/KoryNunn/crel :P
A reverse jQuery of sorts