[FIX] web_editor: also check getComputedStyle in isBlock if other doc
There was a condition in the `isBlock` util meant to bypass `getComputedStyle` in the case that a node was not in the DOM. Rather than doing that however, it was bypassing it in every case where the node was in a document that was different from that of the window. closes odoo/odoo#142803 X-original-commit: 04a9e97603806cb21cd90d991c0f94a225c326c5 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user