From e9026bd5223b52e40bc3e36b00863479b2b76ea0 Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Thu, 21 Mar 2019 13:45:12 +0000 Subject: [PATCH] [FIX] web_editor: editor hang on an infinite loop In the `getMatchedCSSRule`, the transcoder try to find the real value of a `text-align: inherit` css rule by ascending the html tree until it finds a `text-align` with a meaningful value. By default is exits if it reachs the `` top node but doesn't exit if a call to `.parent()` exits the dom (the behavior of jquery is to return a dummy element when calling `.parent()` on an element that has no parent). This lead to an infinite loop for badly formatted html content. opw-1951095 closes odoo/odoo#32014 Signed-off-by: Nicolas Lempereur (nle) --- addons/web_editor/static/src/js/editor/transcoder.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/transcoder.js b/addons/web_editor/static/src/js/editor/transcoder.js index 85903f6b4eb..745e8492b11 100644 --- a/addons/web_editor/static/src/js/editor/transcoder.js +++ b/addons/web_editor/static/src/js/editor/transcoder.js @@ -174,7 +174,7 @@ function getMatchedCSSRules(a) { break; } $el = $el.parent(); - } while (!$el.is('html')); + } while ($el.length && !$el.is('html')); } return style;