move react children coercion to opening element visitor - fixes #1276
This commit is contained in:
@@ -57,6 +57,8 @@ export default function (exports, opts) {
|
||||
|
||||
exports.JSXOpeningElement = {
|
||||
exit(node, parent, scope, file) {
|
||||
parent.children = react.buildChildren(parent);
|
||||
|
||||
var tagExpr = node.name;
|
||||
var args = [];
|
||||
|
||||
@@ -144,10 +146,6 @@ export default function (exports, opts) {
|
||||
};
|
||||
|
||||
exports.JSXElement = {
|
||||
enter(node) {
|
||||
node.children = react.buildChildren(node);
|
||||
},
|
||||
|
||||
exit(node) {
|
||||
var callExpr = node.openingElement;
|
||||
|
||||
|
||||
5
src/babel/transformation/helpers/react.js
vendored
5
src/babel/transformation/helpers/react.js
vendored
@@ -34,9 +34,8 @@ function cleanJSXElementLiteralChild(child, args) {
|
||||
var lines = child.value.split(/\r\n|\n|\r/);
|
||||
|
||||
var lastNonEmptyLine = 0;
|
||||
var i;
|
||||
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i].match(/[^ \t]/)) {
|
||||
lastNonEmptyLine = i;
|
||||
}
|
||||
@@ -44,7 +43,7 @@ function cleanJSXElementLiteralChild(child, args) {
|
||||
|
||||
var str = "";
|
||||
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
var line = lines[i];
|
||||
|
||||
var isFirstLine = i === 0;
|
||||
|
||||
Reference in New Issue
Block a user