patrick-steele-idem / morphdom

Fast and lightweight DOM diffing/patching (no virtual DOM needed)
MIT License
3.21k stars 129 forks source link

Maybe room for improvement? #97

Closed JSteunou closed 5 years ago

JSteunou commented 7 years ago

Reading src code from hyperapp it seems easier & simpler to patch DOM nodes with object from hyperx quite directly without adding all the fuzz like vdom or some mock of native DOM method. hyperapp h function is dead simple and the patch quite light.

Could morphdom benefits from this? Maybe join forces on the patch function?

AutoSponge commented 7 years ago

I'll take a look, but we're talking about a lib that has like 3 tests. So, I'm not hopeful because I don't think that covers all the edge cases for DOM (re)rendering.

JSteunou commented 7 years ago

I follow you, just pointing out because it might bring some fresh idea :)

AutoSponge commented 7 years ago

I've become involved in hyperapp's development.

The significant difference is that h() returns a (non-standard) vnode which is compared to other vnodes on patch. This makes the algorithm very efficient but incapable of operating in a context it did not generate. In this area, morphdom's approach is superior. Morphdom apps can add server-side rendering easily because it compares DOM nodes and they don't need to be in memory. Additionally, PRs and issues are working to resolve things like element reuse--something morphdom already does through ids. My own PR repeats the issues we fixed in morphdom for "externally modified" elements.

Still lots to do over there but I'm learning quite a bit. I wouldn't call hyperapp ready for prime time just yet.

JSteunou commented 7 years ago

And what about https://github.com/WebReflection/hyperHTML? I like it's approach, no DOM or VDOM layer and no patch, just direct & simple update of existing node.

AutoSponge commented 7 years ago

It's on my list 🤔

snewcomer commented 5 years ago

closing this for now...