diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js index 0df11e86dea..dbf52cbef9f 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/utils/utils.js @@ -1242,13 +1242,13 @@ export function isBlock(node) { return false; } // The node might not be in the DOM, in which case it has no CSS values. - if (window.document !== node.ownerDocument) { + if (!node.isConnected) { return blockTagNames.includes(tagName); } // We won't call `getComputedStyle` more than once per node. let style = computedStyles.get(node); if (!style) { - style = window.getComputedStyle(node); + style = node.ownerDocument.defaultView.getComputedStyle(node); computedStyles.set(node, style); } if (style.display) {