diff --git a/mobile/android/chrome/content/JSDOMParser.js b/mobile/android/chrome/content/JSDOMParser.js index 6ac60a7bf283..d4ad8200fbe8 100644 --- a/mobile/android/chrome/content/JSDOMParser.js +++ b/mobile/android/chrome/content/JSDOMParser.js @@ -323,6 +323,9 @@ if (childIndex == -1) { throw "replaceChild: node not found"; } else { + if (newNode.parentNode) + newNode.parentNode.removeChild(newNode); + childNodes[childIndex] = newNode; newNode.parentNode = this; oldNode.parentNode = null;