From b739e659400a223ec2b6d41ef57f27966edfe294 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Thu, 3 May 2018 14:02:04 +0200 Subject: [FIX] web_editor: optimize big mail transcoding The browser may throw an error when a big mail such as one with hundreds thousands of tags is being transformed to have a style more compatible with mail clients. The error would be: "Uncaught RangeError: Maximum call stack size exceeded" This happens in jquery because we hare too many nodes (there is an ongoing issue at https://github.com./jquery/sizzle/issues/403) so this commit replace that part by a DFS traversal over DOM nodes. There was also an issue that not having the option "style-inline" would still cause some style code to be ran albeit it was intended not to be solved in 55c7d2d5b00. opw-1841107 closes #24550 --- addons/web_editor/static/src/js/backend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web_editor/static/src/js/backend.js') diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 964ececa06b..1c5feb7a7d4 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -146,7 +146,7 @@ var FieldTextHtmlSimple = widget.extend({ this.$content.html(this.text_to_html(value)); if (this.get("effective_readonly")) { this.resize(); - } else { + } else if (this.options['style-inline']) { transcoder.style_to_class(this.$content); } if (this.$content.is(document.activeElement)) { -- cgit v1.2.3