diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 99492df6aff..34330ec9a24 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1232,6 +1232,10 @@ const Wysiwyg = Widget.extend({ const eventName = elem.dataset.eventName; let colorpicker = null; const mutex = new concurrency.MutexedDropPrevious(); + if (!elem.ownerDocument.defaultView) { + // In case the element is not in the DOM, don't do anything with it. + continue; + } // If the element is within an iframe, access the jquery loaded in // the iframe because it is the one who will trigger the dropdown // events (i.e hide.bs.dropdown and show.bs.dropdown).