choojs / nanomorph

🚅 - Hyper fast diffing algorithm for real DOM nodes
MIT License
726 stars 58 forks source link

Document Fragments #100

Closed finnp closed 5 years ago

finnp commented 6 years ago

If we allow DocumentFragments to be generated with nanohtml (https://github.com/choojs/nanohtml/pull/118), then we should make sure that they can't be used to morph the existing tree.

Morphing with a DocumentFragment doesn't make sense, because it doesn't have an actual root node.

Potentially we could also define that if a DocumentFragment is used it will only morph the children of the rootTree. That would also solve https://github.com/choojs/nanomorph/issues/96. But I think that should be discussed further somewhere.

For now this is my proposal: I added an assert statement, so it will reject DocumentFragments.

finnp commented 5 years ago

@goto-bus-stop I knew there was a third pull request somewhere 😅If this looks good to you, maybe merge this in too.