yjbanov/butterfly

Replace ElementUpdate object with Element reference

Closed this issue · 2 comments

Instead of creating a generic ElementUpdate description object, the render nodes should take a reference to the parent (host) DOM element. This would also remove the need for a pure js sync-er script, and also remove the ability to run on the VM.

Some notable advantages:

  • Reduce allocations of temp objects (ElementUpdate).
  • Allow easy interop with existing web UI toolkits without modifying the sync-er script.
  • Allow more efficient rendering of nodes which only modify the DOM (decorators) or aren't true Elements, like text or canvas.

Open questions

  • Should the renderNode method receive a reference to the parent dom node, or return the node to be rendered? (the latter makes canvas and interop trickier)

Regarding incremental-dom, I did some prototyping (in JS) with the library. There is a bit of overlap in functionality, but it might allow reducing the amount of work we do in RenderNodes.

https://gist.github.com/jonahwilliams/71d22c88b84f35b247584f6308efbc00

Fixed by #34