Repository navigation
Convert flexbox values for old specs regardless of case - #1586
Merged
Merged
Conversation
CSS keywords are ASCII case-insensitive, but the flexbox hacks looked up their old-spec values case-sensitively. flex-direction: ROW-REVERSE gave box-orient: vertical / box-direction: normal, flex: NONE gave box-flex: NONE and justify-content: SPACE-BETWEEN was copied as-is into box-pack and flex-pack. Lowercase the value before the checks and the oldValues lookups in the flex-direction, flex-flow, flex, justify-content and align-* hacks.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CSS keywords are ASCII case-insensitive, but the flexbox hacks only converted values for the 2009 and 2012 specs when they were written in lowercase.
FlexDirectionandFlexFlowused a case-sensitiveincludes('row')/includes('reverse')(and wrap filter), andFlex,JustifyContent,AlignItems,AlignSelfandAlignContentlooked upoldValues[decl.value]directly. Uppercase values therefore produced a wrong direction or invalid old-spec values.With
overrideBrowserslist: ['Chrome 20', 'Firefox 20', 'IE 10']:Input CSS
Current output CSS
Output after the fix (same as for the lowercase values)
flex-flow: WRAP Rowalso gavebox-orient: vertical, andflex-flow: WRAPadded abox-orient/box-directionpair that the lowercase value does not get.align-selfandalign-contenthad the same lookup for-ms-flex-item-align/-ms-flex-line-pack.The fix lowercases the value only for the checks and the
oldValueslookups, so values that pass through keep the author's case (like #1582).The new test fails before the fix.
pnpm testpasses (294 tests, 100% line coverage, lint and size checks).This PR was prepared with AI assistance (Claude).