Handle uppercase length units for line-height - #271
Open
sarathfrancis90 wants to merge 1 commit into
Open
Conversation
CSS units are case-insensitive, and the library already supports uppercase units for other properties (there is an "allows uppercase units" test). But line-height has its own unit guard that only matched lowercase units, so a value like `line-height: 1.5PX` threw "Failed to parse declaration" even though `font-size: 1.5PX` and `line-height: 1.5px` both work fine. I made the unit regexes used by that guard (and the rem-to-px conversion) case-insensitive so uppercase px/rem/viewport units behave the same as their lowercase form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
line-height: 1.5PXthrows "Failed to parse declaration", even thoughfont-size: 1.5PXandline-height: 1.5pxboth work and there is already an "allows uppercase units" test. CSS units are case-insensitive, but the extra unit guard on line-height only matched lowercase px/rem/viewport units, so a valid uppercase unit fell through to the multiplier error.I made the regexes used by that guard (and the rem-to-px conversion) case-insensitive, so uppercase units are converted the same way as their lowercase form. Added tests for line-height with uppercase px/rem/viewport units and for an uppercase rem margin.