summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorJulien Castiaux <juc@odoo.com>2019-03-21 13:45:12 +0000
committerJulien Castiaux <juc@odoo.com>2019-03-21 13:45:12 +0000
commite9026bd5223b52e40bc3e36b00863479b2b76ea0 (patch)
treeab691bc2f44cc24a39b3f3049ff98539d1b75f9d /addons/web_editor/static/src
parent78d351aa4d0024853d18b24368e9d377061c3493 (diff)
[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 `<html>` 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) <nle@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/transcoder.js2
1 files changed, 1 insertions, 1 deletions
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;