Skip to content

parse: flex: parse flex-shrink before flex-basis in the shorthand - #40

Open
metan-ucw wants to merge 1 commit into
netsurf-browser:masterfrom
metan-ucw:fix-flex-parse
Open

parse: flex: parse flex-shrink before flex-basis in the shorthand#40
metan-ucw wants to merge 1 commit into
netsurf-browser:masterfrom
metan-ucw:fix-flex-parse

Conversation

@metan-ucw

Copy link
Copy Markdown
Contributor

The flex shorthand loop tried the longhands in the order grow, basis, shrink. Because the flex-basis parser also accepts a bare 0, flex: 0 0 600px mis-assigned the second 0 to flex-basis and was then left with 600px to parse as flex-shrink (a ), which fails and invalidates the whole declaration.

The two values are flex-grow and flex-shrink, so try shrink before basis; a unit-bearing length or percentage still falls through to basis.

The flex shorthand loop tried the longhands in the order grow, basis,
shrink.  Because the flex-basis <length> parser also accepts a bare 0,
`flex: 0 0 600px` mis-assigned the second 0 to flex-basis and was then
left with 600px to parse as flex-shrink (a number), which fails and
invalidates the whole declaration.

The two <number> values are flex-grow and flex-shrink, so try shrink
before basis; a unit-bearing length or percentage still falls through to
basis.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Cyril Hrubis <metan@ucw.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant