From c8830d32f74b8c228553f11f7f55b5be45ae6471 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 15 Aug 2014 09:40:22 +0100 Subject: [PATCH] Fixed problem with building TW under Windows Fixes #717 The issue was that under Windows we generate text nodes that contained CRLF as a linebreak (rather than just LF as usual). The subtle problem is that when these strings are placed in the DOM via createTextNode(), the CR character is treated as a printable character, not whitespace. When creating DOM notes with innerHTML or as part of a static HTML document the HTML parser will strip out the CR characters. The hacky solution is to manually remove CRs before building the text node. --- core/modules/widgets/text.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/text.js b/core/modules/widgets/text.js index 4da2119ac..e3ebc4f70 100755 --- a/core/modules/widgets/text.js +++ b/core/modules/widgets/text.js @@ -30,8 +30,9 @@ TextNodeWidget.prototype.render = function(parent,nextSibling) { this.parentDomNode = parent; this.computeAttributes(); this.execute(); - var text = this.getAttribute("text",this.parseTreeNode.text), - textNode = this.document.createTextNode(text); + var text = this.getAttribute("text",this.parseTreeNode.text); + text = text.replace(/\r/mg,""); + var textNode = this.document.createTextNode(text); parent.insertBefore(textNode,nextSibling); this.domNodes.push(textNode); };