Use WeakMap for tagged template / parser values
tbranyen opened this issue · 1 comments
tbranyen commented
Currently diffHTML goes in order and plucks from element, attributes, etc. This sucks when using HTML comments, because the template values still come through, but the parser ignores comment contents, throwing off the interpolation.
Instead diffHTML should be generating an internal WeakMap that creates __DIFFHTML_${++i}__
token and associates the value. Then once the parser reassembles the Virtual Tree nodes, we can reference the precise value. And if the end user uses an HTML comment it will not throw off the interpolation.
tbranyen commented
I didn't end up needing a weakmap, just converted the supplemental arrays to objects and reference by an incremental counter, been working great!