[FIX] web_editor: traceback on copy paste table in firefox

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) <sge@odoo.com>
This commit is contained in:
visp-odoo
2023-11-30 19:55:01 +00:00
parent c457d0e401
commit 717300723d
@@ -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();
}