Support for appending a cloned template adjacent to an existing element #1250
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
What problem are you trying to solve?
I frequently encounter scenarios where I need to take a template, and rather than append it to a child of a node, I instead need to insert the contents adjacent to an existing element. Examples include adding rows to a table, or list items.
The demand to be able to do this, I think, is demonstrated by JSX's support for the fragments ("<>") as well.
The following naive approach gives a runtime error:
What solutions exist today?
This can be done programmatically with a significant amount of effort, using some combination of insertAdjacentElement, insertAdjacentText, etc.. Creating a function in userland is certainly doable. I confess I have searched for someone to have published such a function, that I could point to, with a high record of downloads, and I've come up short finding even one example of such a function, so perhaps the demand isn't that great, which mystifies me, so maybe I'm missing something.
What does work is target.insertAdjacentHTML(source.innerHTML), but then:
How would you solve it?
Something like
Anything else?
If insertAdjacentHTML could return the children inserted, that might be helpful.
The text was updated successfully, but these errors were encountered: