Freak613 / stage0

Collection of low-level DOM tools for building high performant web interfaces
MIT License
261 stars 16 forks source link

Collecting references #20

Open kokujin opened 5 years ago

kokujin commented 5 years ago
  <h2>#test</h2>
  <div>
  <h2>Test</h2>
    <h1>#count</h1>
    <button #down>-</button>
    <button #up>+</button>
  </div>

Given the view snippet above, I tried to collect references using

const { count, down, up, board, test } = view.collect(view)

This failed and collection stopped at the first node, "H2". How do I collect all references in a view with different nodes? Thanks

Freak613 commented 5 years ago

Yeah, currently, stage0 doesn't support fragments, i.e. >2 root nodes in the template. I'll update you once implemented.

pokerman79 commented 5 years ago

any update or even better pointer how to do support for template fragments ?

gkn06 commented 4 years ago

@Freak613 any update on this feat?

Freak613 commented 4 years ago

Not yet. The thing that I'm struggling with the most here is that introducing fragments will require proper reconciler support, because once inserted they will lose their context of the link with the siblings, and also will be removed from fragment. Without reconcile, it will leave the library in inconsistent state. And for reconciler, to have it working, the problem require hacks or additional structures for storing relations in the dom nodes or outside of it in the vdom. That's the pro of the vdom approach, that it can keep non-standart things in mind.