My main gripe with who-ps-html
is that it generates a string, which means that you don't have a real DOM object to play with; you must wait to render that object before being able to do things on it.
horse-html fixes that by generating real DOM elements in JavaScript, and returning those.
The absolute best feature of horse-html is that the closures also magically work. If you define an onclick
on an element, the JavaScript will use the closures generated wherever your code is defining that onclick
attribute.
PS: the code can definitely be improved. I suck. But for the little use cases I have, it works. Feedback definitely welcome. I'm notably not a fan of the nested functions, but couldn't figure out a better way.