Closed dy closed 5 years ago
I believe we support morph-ing when the first argument is an HTMLElement. One of the requirements is we have to "walk" the DOM tree. Is that possible with document fragments?
Yes, there's nothing special about documentFragment, it is instance of Node (nodeType === 11). It can be both walked directly or via TreeWalker
So the only thing it doesn't have is attributes
. So seems like we need a guard using nodeType === 1
. Is that something you have time to put up a PR for with test? Otherwise, I can do it!
I have difficulties with setting up mocha/chrome for windows, not sure what's going on. It seems it will be easier if you do it, if you don't mind. Here's the draft PR I came up with, that seems to be the only required change https://github.com/patrick-steele-idem/morphdom/pull/167
Fixed per #167
As a reflection of #53 - would be useful to have reverse diffing:
Now that is not supported, gives error:
Context: pre-render DOM into background fragment, in order to later insert into some mounted DOM node.