observablehq / htl

A tagged template literal that allows safe interpolation of values into HTML, following the HTML5 spec
https://observablehq.com/@observablehq/htl
ISC License
305 stars 24 forks source link

Diffing? #17

Closed evatrium closed 3 years ago

evatrium commented 4 years ago

Hi, love the approach with this library. Would it ever be possible to use this for diffing against dom/vdom in someway, dynamically updating only changed parts, just as lit-html or preact would? Or is the goal of this to set it and forget it? And if I'm completely missing the mark, could someone provide an example on how to dynamically update content using this?

tomlarkworthy commented 3 years ago

This has been working ok for me https://observablehq.com/@tomlarkworthy/reconcile-nanomorph

mbostock commented 3 years ago

Sorry for the delayed response. I’m not currently planning on implementing diffing for this library. Partly it’s because there are already good tools for that (such as lit-html). Partly it’s too keep things simple. And partly because I’d like to explore a different approach (interpolating async iterables), when I have time.