Merge pull request #3444 from drd/dont-mangle-jsxexpressioncontainer-stringliterals
Preserve whitespace in JSXExpressionContainer StringLiteral children
This commit is contained in:
commit
e4be235e67
@ -63,7 +63,7 @@ export default function (opts) {
|
||||
function convertAttribute(node) {
|
||||
let value = convertAttributeValue(node.value || t.booleanLiteral(true));
|
||||
|
||||
if (t.isStringLiteral(value)) {
|
||||
if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
|
||||
value.value = value.value.replace(/\n\s+/g, " ");
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<button data-value={"a value\n with\nnewlines\n and spaces"}>Button</button>;
|
||||
@ -0,0 +1,5 @@
|
||||
React.createElement(
|
||||
"button",
|
||||
{ "data-value": "a value\n with\nnewlines\n and spaces" },
|
||||
"Button"
|
||||
);
|
||||
Loading…
x
Reference in New Issue
Block a user