From 717300723dd6735ab44a07fafc677553f2c7548f Mon Sep 17 00:00:00 2001 From: visp-odoo Date: Sat, 11 Nov 2023 21:26:31 +0530 Subject: [PATCH] [FIX] web_editor: traceback on copy paste table in firefox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: Copy pasting table in firefox gives us traceback because the firefox does not support :has() selector. After this commit: Now it will not give any traceback. task-3591148 closes odoo/odoo#144256 X-original-commit: 224c42e4dedbb18b7f023756d652bb935d5d9829 Signed-off-by: Geelen Sébastien (sge) --- .../static/src/js/editor/odoo-editor/src/OdooEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js index a79334a99b4..35350b6e88e 100644 --- a/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js +++ b/addons/web_editor/static/src/js/editor/odoo-editor/src/OdooEditor.js @@ -3761,7 +3761,8 @@ export class OdooEditor extends EventTarget { td.remove(); } } - for (const tr of tableClone.querySelectorAll('tr:not(:has(td))')) { + const trsWithoutTd = Array.from(tableClone.querySelectorAll('tr')).filter(row => !row.querySelector('td')); + for (const tr of trsWithoutTd) { if (closestElement(tr, 'table') === tableClone) { // ignore nested tr.remove(); }