Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: fix jsx text attributes with double quotes #29079

Merged

Conversation

josephsavona
Copy link
Contributor

Fixes #29069 by detecting the presence of double-quotes in JSX attribute strings and falling back to using an expression container.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels May 15, 2024
@josephsavona josephsavona force-pushed the fix-jsx-text-attribute-w-double-quote branch from ff04156 to 3f0461e Compare May 15, 2024 21:26
@react-sizebot
Copy link

react-sizebot commented May 15, 2024

Comparing: c93c30f...9e82704

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.66 kB 6.66 kB +0.11% 1.82 kB 1.82 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 495.01 kB 495.01 kB = 88.68 kB 88.68 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.67 kB 6.67 kB +0.05% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 499.81 kB 499.81 kB = 89.36 kB 89.36 kB
facebook-www/ReactDOM-prod.classic.js = 592.16 kB 592.16 kB = 104.15 kB 104.15 kB
facebook-www/ReactDOM-prod.modern.js = 568.39 kB 568.39 kB = 100.55 kB 100.55 kB
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
test_utils/ReactAllWarnings.js Deleted 64.26 kB 0.00 kB Deleted 16.02 kB 0.00 kB

Generated by 🚫 dangerJS against 9e82704

@josephsavona josephsavona force-pushed the fix-jsx-text-attribute-w-double-quote branch from 3f0461e to 9e82704 Compare May 15, 2024 21:33
Copy link
Contributor

@mofeiZ mofeiZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh makes sense, this should be a no-op to jsx transforms that consume compiler output and make tools like playground easier to use.

Seems spec compatible as well as the spec doesn't define escaped characters (looking at esbuild facing the same problem here evanw/esbuild#959)

@josephsavona josephsavona merged commit 3adca7a into facebook:main May 15, 2024
46 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler: Unexpected token error when using double quotes Inside single-quoted JSX prop
5 participants