[FIX] web_editor: prevent error on undefined closest Node
Summary: page with 2 popups (newsletter popup and regular popup), cookie bar all justaposed. Chatbot window also open. For some reason closestBlock(testedNode) is undefined (testedNode) is a #text Node. Change already in place for 16.3 Cause: no preventive measure for null value before creating a node iterator on the value.Node in dom does not have an ancestor of type block. Solution: backport solution from 16.3, return false when currentNodeParentBlock is null, since preceding and following would also be undefined, return false. opw-3395673 closes odoo/odoo#132590 X-original-commit: 8a72f669813bc7d8aa9038d75e08ecef00b70e01 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> Co-authored-by: Pedro Manuel Calheiros Lima de Sousa <peso@odoo.com>
This commit is contained in:
committed by
Pedro Manuel Calheiros Lima de Sousa (peso)
co-authored by
Pedro Manuel Calheiros Lima de Sousa
parent
d852a81645
commit
2ab529ed29
@@ -404,6 +404,11 @@ describe('Utils', () => {
|
||||
const result = closestBlock(p);
|
||||
window.chai.expect(result).to.equal(p);
|
||||
});
|
||||
it('should return null if no block ancestor', () => {
|
||||
const node = document.createTextNode('\n ');
|
||||
window.chai.expect(closestBlock(node)).to.equal(null);
|
||||
window.chai.expect(isVisibleTextNode(node)).to.equal(false);
|
||||
});
|
||||
});
|
||||
describe('lastLeaf', () => {
|
||||
it('should find the last leaf of a child-rich block', () => {
|
||||
|
||||
Reference in New Issue
Block a user