Closed GreenMashimaro closed 5 years ago
In case of unmounting the fragment, Vue will try to unmount the fragment root node. In that case, instead of removing the root node, we remove all the fragment's children, and then turn this method back to normal.
This behavior is enforced by the if
statement in L70, and you can see that in any other case than removing the fragment itself, the parent.removeChild behaves as the original behavior.
Thank you very much for your reply. I see. I haven't considered it comprehensively enough. If necessary, consider adding a short comment description to this code for other developers to understand.
https://github.com/y-nk/vue-fragment/blob/ad86ea2fa3aadd8fa980f2d7f240c8214f8b32bd/src/component.js#L69
Hello, excuse me, what is the function of this parent.removeChild method? When I debugged the code, I found that this method was not used.
If there is no method in use, I recommend deleting it and keeping the code clean.