diff --git a/addons/web_editor/static/src/js/backend.js b/addons/web_editor/static/src/js/backend.js index 52ef2017a14..1516a912b61 100644 --- a/addons/web_editor/static/src/js/backend.js +++ b/addons/web_editor/static/src/js/backend.js @@ -307,7 +307,15 @@ var FieldTextHtml = widget.extend({ return this.editor.save(); } else if (this._dirty_flag && this.editor && this.editor.buildingBlock) { this.editor.buildingBlock.clean_for_save(); - this.internal_set_value( this.$content.html() ); + + // escape text nodes for xml saving + var $escaped_el = this.$content.clone(); + $escaped_el.find('*').addBack().not('script,style').contents().each(function(){ + if(this.nodeType == 3) { + this.nodeValue = _.escape(this.nodeValue); + } + }); + this.internal_set_value( $escaped_el.html() ); } }, destroy: function () {