From cfee68aa6782192583b93507b8e14f64a1d664e8 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Tue, 11 Nov 2014 15:26:25 +1100 Subject: [PATCH] jsx: replace all newlines and excess whitespace with spaces - fixes #142 --- lib/6to5/transformation/transformers/jsx.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/6to5/transformation/transformers/jsx.js b/lib/6to5/transformation/transformers/jsx.js index f81d528cdf..2b3bd90c9b 100644 --- a/lib/6to5/transformation/transformers/jsx.js +++ b/lib/6to5/transformation/transformers/jsx.js @@ -81,6 +81,11 @@ exports.XJSElement = { var children = node.children; _.each(children, function (child) { + if (t.isLiteral(child) && _.isString(child.value)) { + child.value = child.value.trim().replace(/\n(\s+)/g, " "); + if (!child.value) return; + } + callExpr.arguments.push(child); });