add JSXAttribute visitor function, wraps JSXElement attributes in a JSXExpressionContainer; also adds test fixtures (#6006)
This commit is contained in:
parent
19c4dd2d8c
commit
51a293601b
@ -47,6 +47,12 @@ export default function({ types: t }) {
|
||||
);
|
||||
};
|
||||
|
||||
visitor.JSXAttribute = function(path) {
|
||||
if (t.isJSXElement(path.node.value)) {
|
||||
path.node.value = t.jSXExpressionContainer(path.node.value);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
inherits: jsx,
|
||||
visitor,
|
||||
|
||||
@ -0,0 +1 @@
|
||||
<div attr=<div /> />
|
||||
@ -0,0 +1,3 @@
|
||||
React.createElement("div", {
|
||||
attr: React.createElement("div", null)
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user