-
Notifications
You must be signed in to change notification settings - Fork 318
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
fix: Properly parse multi-value shorthand with slash #859
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying to fix this edge case, but the logic isn't quite right.
(Note: also, this code path is only used if you use the legacy-expand-shorthands
configuration which should not be needed in the vast majority of use-cases.)
|
||
test('Splits a string of values with slash notation appropriately.', () => { | ||
expect(splitValue('1px/2px 3px 4px 5px')).toEqual([ | ||
'1px/2px', | ||
'3px', | ||
'4px', | ||
'5px', | ||
]); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not how border-radius values are expanded. The correct expansion should be:
test('Splits a string of values with slash notation appropriately.', () => { | |
expect(splitValue('1px/2px 3px 4px 5px')).toEqual([ | |
'1px/2px', | |
'3px', | |
'4px', | |
'5px', | |
]); | |
}); | |
}); | |
test('Splits a string of values with slash notation appropriately.', () => { | |
expect(splitValue('1px/2px 3px 4px 5px')).toEqual([ | |
'1px 2px', | |
'1px 3px', | |
'1px 4px', | |
'1px 5px', | |
]); | |
}); | |
}); |
See https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
which mentions:
border-radius: 4px 3px 6px / 2px 4px;
/* It is equivalent to: */
border-top-left-radius: 4px 2px;
border-top-right-radius: 3px 4px;
border-bottom-right-radius: 6px 2px;
border-bottom-left-radius: 3px 4px;
To further explain, a border-radius
value can only contain a single /
and it separates the "vertical" / "horizontal"
border radii.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I misunderstood the usage of /
in border-radius
. I will review the specification and correct the code accordingly.
@nmn I've revised the expansion logic for cases involving '/' and corrected the code. Additionally, I've updated the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Will merge this PR after doing more testing as this code primarily affects internal code. |
What changed / motivation ?
Fixed the expansion handling of border-radius shorthand values containing the '/' separator.
Linked PR/Issues
Fixes #730
Additional Context
Pre-flight checklist
Contribution Guidelines