[DOM Mock] Fix insertBefore when the reference node follows the moving child in a nodeList

This commit is contained in:
Pierre-Yves Gérardy 2018-04-20 23:00:50 +02:00 committed by Pierre-Yves Gérardy
parent c6693aa361
commit 9136585fe4
2 changed files with 23 additions and 0 deletions

View file

@ -101,6 +101,7 @@ module.exports = function(options) {
if (index > -1) this.childNodes.splice(index, 1)
if (reference === null) this.appendChild(child)
else {
if (index !== -1 && refIndex > index) refIndex--
if (child.nodeType === 11) {
this.childNodes.splice.apply(this.childNodes, [refIndex, 0].concat(child.childNodes))
while (child.firstChild) {