Unable to click html button when the cell generating it is being rapidly rerun

I’ve documented my problem here. I think the issue is that, since the cell is rerun every frame, the button is redrawn every frame which isn’t long enough for onclick to ever be triggered. Is there a workaround available?

One way to prevent people from having this problem in the future would be if the new hypertext literal supported React-style incremental updates. But maybe that would be a lot of work for limited benefit. In the meantime I’d be happy to know of any workaround!

reconcile with nanomorph against ‘this’ (previous value of cell) fixes it.

return html


return reconcile(this, html)


If I use Mike Bostock’s recent bare bones nanomnorph wrapper [1] that trick does not work so simply. nanomorph chokes on the initial state when ‘this’ is null

[1] Hello, nanomorph! / Mike Bostock / Observable

Nanomorph worked, thanks!

Cool, you used Mike’s nanomorph? I am wondering if I should trash my notebook, its almost pointless now, but at the same time, it does handle a few tiny things and the name is semantic so I am not sure.