-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add utility function to split string into component values #209
Add utility function to split string into component values #209
Conversation
fb9ecee
to
e7b8d1a
Compare
c590806
to
1afa09f
Compare
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.
Overall structure looks good. A few remarks to address.
1afa09f
to
8e1896c
Compare
Thanks for the review @bramus 🙏 I think I've addressed all your remarks: https://github.com/flackr/scroll-timeline/compare/1afa09f2c7a3c39efc4a348f0940fd6fb6b03085..8e1896c3c547119a6bafed25ffd764f0efd786b4 |
Just came to the realization one can perfectly author something like Now, I don’t think anyone would write such a declaration and consider this be an extreme edge case, so I’m fine with merging this as is. /ping @flackr for an opinion on this. |
We could easily handle that in |
8e1896c
to
14cde5b
Compare
Updated the PR to support |
When parsing component values passed as a string to
rangeStart
,rangeEnd
andinset
we have previously used str.split(), either with a single whitespace or with a regex with various issues:'calc(2 * 10px) auto'.split(' ')
returns['calc(2', '*', '10px)', 'auto']
, breaking apart functions'calc(2 * 10px) auto'.split(/(?<!\([^\)]*)\s(?![^\(]*\))/)
returns['calc(2 * 10px)', 'auto']
as expected, but causes an error in browsers without support for lookaheadThis PR adds a utility function
splitIntoComponentValues(input)
that splits a string with multiple component values into an array of individual component value strings. These can then be processed either as keywords or be further parsed usingCSSNumericValue.parse()
.