I found that when the reference node is not an Element, such as a comment, the insertion correctly occurs in the childNodes array, but the target node is not removed from childNodes; it is only removed from children. Therefore, I have added code that also removes the target node from childNodes.
Resolves #1406.
I found that when the reference node is not an Element, such as a comment, the insertion correctly occurs in the
childNodes
array, but the target node is not removed fromchildNodes
; it is only removed fromchildren
. Therefore, I have added code that also removes the target node fromchildNodes
.