Skip to content

Commit

Permalink
fix(codegen): print JSXAttributeValue::StringLiteral directly (#4231)
Browse files Browse the repository at this point in the history
jsx attribute string is interpreted as is without escaping.

The transformer is responsible for converting it to plain js string.
  • Loading branch information
Boshen committed Jul 12, 2024
1 parent 6fb808f commit be82c28
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for JSXAttributeValue<'a> {
Self::Element(el) => el.gen(p, ctx),
Self::StringLiteral(lit) => {
p.print_char(b'"');
print_unquoted_str(&lit.value, b'"', p);
p.print_str(&lit.value);
p.print_char(b'"');
}
Self::ExpressionContainer(expr_container) => expr_container.gen(p, ctx),
Expand Down
4 changes: 1 addition & 3 deletions tasks/coverage/codegen_typescript.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ commit: d8086f14

codegen_typescript Summary:
AST Parsed : 5283/5283 (100.00%)
Positive Passed: 5280/5283 (99.94%)
Normal failed: "compiler/jsxMultilineAttributeStringValues.tsx"
Normal failed: "compiler/jsxMultilineAttributeValuesReact.tsx"
Positive Passed: 5282/5283 (99.98%)
Normal failed: "conformance/jsx/tsxReactEmitEntities.tsx"

0 comments on commit be82c28

Please sign in to comment.