@@ -554,37 +554,22 @@ export function transformJsx(context: TransformationContext): (x: SourceFile | B
554554 return fixed === undefined ? undefined : factory . createStringLiteral ( fixed ) ;
555555 }
556556
557- /**
558- * Remove comments from JSX text content.
559- * Comments like slash-star comment star-slash should not be treated as text content in JSX.
560- */
561- function stripCommentsFromJsxText ( text : string ) : string {
562- // Only strip comments when not in preserve mode
563- if ( compilerOptions . jsx === JsxEmit . Preserve ) {
564- return text ;
565- }
566- // Remove /* ... */ style comments from JSX text
567- return text . replace ( / \/ \* [ \s \S ] * ?\* \/ / g, '' ) ;
568- }
569-
570- /**
571- * JSX trims whitespace at the end and beginning of lines, except that the
572- * start/end of a tag is considered a start/end of a line only if that line is
573- * on the same line as the closing tag. See examples in
574- * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx
575- * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model
576- *
577- * An equivalent algorithm would be:
578- * - If there is only one line, return it.
579- * - If there is only whitespace (but multiple lines), return `undefined`.
580- * - Split the text into lines.
581- * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines.
582- * - Decode entities on each line (individually).
583- * - Remove empty lines and join the rest with " ".
584- */
585- function fixupWhitespaceAndDecodeEntities ( text : string ) : string | undefined {
586- // First, strip comments from the text
587- text = stripCommentsFromJsxText ( text ) ;
557+ /**
558+ * JSX trims whitespace at the end and beginning of lines, except that the
559+ * start/end of a tag is considered a start/end of a line only if that line is
560+ * on the same line as the closing tag. See examples in
561+ * tests/cases/conformance/jsx/tsxReactEmitWhitespace.tsx
562+ * See also https://www.w3.org/TR/html4/struct/text.html#h-9.1 and https://www.w3.org/TR/CSS2/text.html#white-space-model
563+ *
564+ * An equivalent algorithm would be:
565+ * - If there is only one line, return it.
566+ * - If there is only whitespace (but multiple lines), return `undefined`.
567+ * - Split the text into lines.
568+ * - 'trimRight' the first line, 'trimLeft' the last line, 'trim' middle lines.
569+ * - Decode entities on each line (individually).
570+ * - Remove empty lines and join the rest with " ".
571+ */
572+ function fixupWhitespaceAndDecodeEntities ( text : string ) : string | undefined {
588573 let acc : string | undefined ;
589574 // First non-whitespace character on this line.
590575 let firstNonWhitespace = 0 ;
0 commit comments