Snabbdom patches over given container
See original GitHub issueWhile I’ve been writing my intergration for snabbdom with Cycle.js, I’ve come to notice that running for example patch(document.querySelector('.app'), view)
, snabbdom is actually patching over .app
. However my needs are for the view to be appended to .app
, because I need to listen to events relative to .app
. Is there a way to do this currently or is it possible to add support for this? I’d be happy to submit a PR if it is needed and would be accepted.
Thank you for your time.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:48 (29 by maintainers)
Top Results From Across the Web
snabbdom/snabbdom - Gitter
Question—is there a way to prevent snabbdom patch from overwriting an element? For example, given <div id="container"><div id="one">one</div><div ...
Read more >Snabbdom Renderer - ServiceNow Developers
Patches an empty vnode to the element so we run hooks and cleanup ... This hook is invoked on a virtual node when...
Read more >tea-snabbdom / ento / Observable
patch = RuntimeError: Failed to fetch dynamically imported module: https://unpkg.com/snabbdom@1.0.1/build/package/modules/attributes.js.
Read more >Using Proxy and Virtual DOM to Build Your Own Framework
Also, upon inspecting each rendering, the child HTML of the container is replaced ... var patch = snabbdom.init([ // Init patch function with...
Read more >snabbdom.scala
Virtual DOM for Scala.js based on Snabbdom.js ... "Please enter a value: ", input( size := 3, onChange := foo ) ) //...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@paldepind if you split the vtree-build/diff and DOM-hydration stages, it becomes trivial to hydrate the vtree from a server-built DOM without any diffing (assuming it was built from the identical vtree). in domvm, the entire loop is a few recursive lines: https://github.com/leeoniya/domvm/blob/master/src/view.js#L309-L318
@avesus In principle you can do that. That is what virtual-dom does. But diffing just a real DOM tree against a virtual one is not as fast as diffing two virtual trees against each other. Thus that is what Snabbdom does. In your case it would have been nice if Snabbdom could patch DOM against VDOM. But it would be a lot of extra code. I think the workaround is acceptable. You only have to do it once.