From 25d8377411430403e570ef330a12120ea882f04c Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Fri, 13 Feb 2015 15:08:39 +1100 Subject: [PATCH] normalise JSX attribute strings --- lib/6to5/transformation/helpers/build-react-transformer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/6to5/transformation/helpers/build-react-transformer.js b/lib/6to5/transformation/helpers/build-react-transformer.js index 29c78bacac..85b865bf44 100644 --- a/lib/6to5/transformation/helpers/build-react-transformer.js +++ b/lib/6to5/transformation/helpers/build-react-transformer.js @@ -46,6 +46,11 @@ module.exports = function (exports, opts) { exports.JSXAttribute = { exit: function (node) { var value = node.value || t.literal(true); + + if (t.isLiteral(value) && isString(value.value)) { + value.value = value.value.replace(/\n\s+/g, " "); + } + return t.inherits(t.property("init", node.name, value), node); } };