diff --git a/js/ui/components/EmbedVideoModal.js b/js/ui/components/EmbedVideoModal.js index 0f3474be..54e5ab8e 100644 --- a/js/ui/components/EmbedVideoModal.js +++ b/js/ui/components/EmbedVideoModal.js @@ -98,8 +98,14 @@ export class EmbedVideoModal { const wrapper = this.document.createElement("div"); wrapper.innerHTML = html; this.removeTrackingScripts(wrapper); - this.container.appendChild(wrapper); - modal = wrapper.querySelector("#embedVideoModal"); + + const fragment = this.document.createDocumentFragment(); + while (wrapper.firstChild) { + fragment.appendChild(wrapper.firstChild); + } + this.container.appendChild(fragment); + + modal = this.container.querySelector("#embedVideoModal"); } if (!modal) {