Make a clone of html element in _hyperscript

Viewed 83

How to make a clone of html element in _hyperscript?

For example, I want to see a copy of a button after clicking on it. Something like:

<button _="on click put me after me">Test</button>
2 Answers

If you want the hyperscript to work for new nodes I currently do something like this:

<div id="test123">
   <div _="on click log 'Test' then put my outerHTML after me 
       _hyperscript.processNode(#test123)">Copy Me</div>
</div>
<button _='on click put my outerHTML after me'>Test</button>

However, only clicking the original button produces a copy this way.

Related