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.
When Streetmix was originally written, the CSS
transform
property was still considered "experimental" and many browsers prefixed it (e.g.-webkit-transform
,-ms-transform
, etc.). Adding vendor-prefixed properties in CSS are still fine (Autoprefixer handles it for us), but in JavaScript, where our code might need to dynamically update an inlinetransform
style, we relied on the Modernizr library to detect the correct vendor prefix, and then we stored that prefix in oursystem
Redux state for later use. Thus, adding a transform style to a React component required connecting to Redux, reading the prefix, and then doing something like this:This meant adding complexity to our code and our tests. Here, I revisit this to see whether we can conceivably remove this from our code.
Browser support at this time suggests that it is now relatively safe to remove vendor prefixes (Sources: MDN, CanIUse.) That being said, it is the nature of CSS that we should be able to add the vendor-prefixed properties simultaneously with the un-prefixed property and the browser should automatically know what to do, so we should no longer need to detect prefixes. Adding vendor-prefixed properties to inline styles is fully supported in React.
Thus my proposal is to do the following:
With this change, we can remove the Redux state that tracks the vendor prefix.
If accepted, this affects PR #1255.