I found myself in need of the ability to use a template in a way that sometimes, one of the substitutions could be the inclusion of an existing element. Specifically, I want to insert a hyperlink node into the template.
I'll solve the problem for now by inserting theLink.outerHTML, but this might lose any behaviors that were attached to the element?
I'm wondering how hard it would be to allow Templates to take nodes as parameters. Right now, it can't because the template compiler builds a large array join and assumes each array item will be a string. But if it instead were changed to an X=insertBefore(target, node) followed by X=insertAfter(X, node[i]) statements, I think it could be supported? (The inner function could just check if the thing is already a node, and just return it)