Skip to content
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

Trim css color before parsing #255

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

kajkal
Copy link
Contributor

@kajkal kajkal commented Jul 7, 2023

Fix for #2812

Allow for leading or trailing spaces in css color values.
Treat values like " rgba(220, 230, 200, 1)" as valid.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@HarelM
Copy link
Member

HarelM commented Jul 7, 2023

What about other places where there is a space? Like " red "?

@kajkal
Copy link
Contributor Author

kajkal commented Jul 7, 2023

If we want to support values like " rgba(220, 230, 200, 1)" then I think we should similarly support values like " red ". It could easily be made so that only the rgb()/rgba()/hsl()/hsla() formats support leading/trailing spaces, but in such a situation I think this would not be consistent behavior - in my opinion it is better to either support this behavior in every format or not support it at all.

Personally, I am not a fan of supporting color values with leading/trailing spaces but if there are established styles that use such values I think we should adapt.

@HarelM HarelM merged commit 53186c4 into maplibre:main Jul 9, 2023
6 checks passed
@HarelM
Copy link
Member

HarelM commented Jul 9, 2023

Can you open another PR with the addition of this fix to the changelog?
Forgot to ask it before I merged.
Also can you bump the patch version so I'll be able to easily release a new version with this fix?

@kajkal
Copy link
Contributor Author

kajkal commented Jul 10, 2023

I didn't add the changelog entry because I wasn't sure in which repo it should be added (maplibre-style-spec or maplibre-gl-js).
I opened a simple PR for the 19.2.2 release - #265.

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.

None yet

2 participants