capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.09k stars 185 forks source link

fix: [1406] Fixes issue with insertBefore and comment reference node #1407

Closed mdafanasev closed 2 months ago

mdafanasev commented 2 months ago

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 from childNodes; it is only removed from children. Therefore, I have added code that also removes the target node from childNodes.