Preserve namespaced attributes when throwIfNamespace is false (#7173)
Previously that part would throw since it expects a JSXIdentifier but it (logically) gets a JSXNamespacedName when using a namespaced attribute.
This commit is contained in:
parent
74682f33bc
commit
63157159ab
@ -92,7 +92,11 @@ You can turn on the 'throwIfNamespace' flag to bypass this warning.`,
|
||||
if (t.isValidIdentifier(node.name.name)) {
|
||||
node.name.type = "Identifier";
|
||||
} else {
|
||||
node.name = t.stringLiteral(node.name.name);
|
||||
node.name = t.stringLiteral(
|
||||
t.isJSXNamespacedName(node.name)
|
||||
? node.name.namespace.name + ":" + node.name.name.name
|
||||
: node.name.name,
|
||||
);
|
||||
}
|
||||
|
||||
return t.inherits(t.objectProperty(node.name, value), node);
|
||||
|
||||
@ -1 +1 @@
|
||||
<f:image />;
|
||||
<f:image n:attr />;
|
||||
|
||||
@ -1 +1,3 @@
|
||||
h("f:image", null);
|
||||
h("f:image", {
|
||||
"n:attr": true
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user