Skip to content

Commit

Permalink
escape jsx attribute name
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk committed Mar 17, 2023
1 parent c51c289 commit 23379dd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ import {
JsxElement,
JsxEmit,
JsxFragment,
JsxNamespacedName,
JsxOpeningElement,
JsxOpeningLikeElement,
JsxSelfClosingElement,
Expand Down Expand Up @@ -10134,13 +10133,13 @@ export function tryGetJSDocSatisfiesTypeNode(node: Node) {
}

/** @internal */
export function getEscapedTextOfJsxAttributeName(node: Identifier | JsxNamespacedName): __String {
return isIdentifier(node) ? node.escapedText : (getEscapedTextOfJsxAttributeName(node.namespace) + ":" + getEscapedTextOfJsxAttributeName(node.name)) as __String;
export function getEscapedTextOfJsxAttributeName(node: JsxAttributeName): __String {
return isIdentifier(node) ? node.escapedText : `${node.namespace.escapedText}:${idText(node.name)}` as __String;
}

/** @internal */
export function getTextOfJsxAttributeName(node: Identifier | JsxNamespacedName): string {
return isIdentifier(node) ? idText(node) : getTextOfJsxAttributeName(node.namespace) + ":" + getTextOfJsxAttributeName(node.name);
export function getTextOfJsxAttributeName(node: JsxAttributeName): string {
return isIdentifier(node) ? idText(node) : `${idText(node.namespace)}:${idText(node.name)}`;
}

/** @internal */
Expand Down

0 comments on commit 23379dd

Please sign in to comment.