mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[jsx] Make sure we throw when we get XML namespaces
https://github.com/facebook/esprima/commit/aad8a2b798ca80342a744aac2869fc1feb0065dd replaced XJSIdentifer with XJSNamespacedName for namespaced items, so we need to adjust here accordingly.
This commit is contained in:
+7
-9
@@ -57,17 +57,15 @@ function visitReactTag(traverse, object, path, state) {
|
||||
|
||||
utils.catchup(openingElement.range[0], state, trimLeft);
|
||||
|
||||
var isFallbackTag = false;
|
||||
|
||||
if (nameObject.type === Syntax.XJSIdentifier) {
|
||||
if (nameObject.namespace) {
|
||||
throw new Error(
|
||||
'Namespace tags are not supported. ReactJSX is not XML.');
|
||||
}
|
||||
|
||||
isFallbackTag = FALLBACK_TAGS.hasOwnProperty(nameObject.name);
|
||||
if (nameObject.type === Syntax.XJSNamespacedName && nameObject.namespace) {
|
||||
throw new Error('Namespace tags are not supported. ReactJSX is not XML.');
|
||||
}
|
||||
|
||||
// Only identifiers can be fallback tags. XJSMemberExpressions are not.
|
||||
var isFallbackTag =
|
||||
nameObject.type === Syntax.XJSIdentifier &&
|
||||
FALLBACK_TAGS.hasOwnProperty(nameObject.name);
|
||||
|
||||
utils.append(isFallbackTag ? jsxObjIdent + '.' : '', state);
|
||||
|
||||
utils.move(nameObject.range[0], state);
|
||||
|
||||
Reference in New Issue
Block a user