You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(compat): map imageRendering to image-rendering - #5270
Root cause: #3995 changed image in the CAMEL_PROPS regex of compat/src/render.js to image(!S) so that imageSrcSet is no longer turned into image-src-set. The ? of the negative lookahead is missing, so (!S) is a capture group that matches the literal text !S. No real prop contains that, so every image* prop stopped being converted. As a result <svg imageRendering="pixelated" /> renders an imageRendering attribute, which the browser ignores, while React renders image-rendering.
Fix: use the intended lookahead image(?!S). imageRendering becomes image-rendering again, while imageSrcSet and imageSizes are still left alone.
Test: added should transform imageRendering to compat/test/browser/render.test.jsx. It fails on main (<svg imageRendering="pixelated"></svg>) and passes with the fix. The existing should not transform imageSrcSet test still passes, as does the rest of the compat suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause: #3995 changed
imagein theCAMEL_PROPSregex ofcompat/src/render.jstoimage(!S)so thatimageSrcSetis no longer turned intoimage-src-set. The?of the negative lookahead is missing, so(!S)is a capture group that matches the literal text!S. No real prop contains that, so everyimage*prop stopped being converted. As a result<svg imageRendering="pixelated" />renders animageRenderingattribute, which the browser ignores, while React rendersimage-rendering.Fix: use the intended lookahead
image(?!S).imageRenderingbecomesimage-renderingagain, whileimageSrcSetandimageSizesare still left alone.Test: added
should transform imageRenderingtocompat/test/browser/render.test.jsx. It fails onmain(<svg imageRendering="pixelated"></svg>) and passes with the fix. The existingshould not transform imageSrcSettest still passes, as does the rest of the compat suite.The same typo is present on
v10.x.