Skip to content

Handle uppercase length units for line-height - #271

Open
sarathfrancis90 wants to merge 1 commit into
kristerkari:masterfrom
sarathfrancis90:fix-css-transform
Open

Handle uppercase length units for line-height#271
sarathfrancis90 wants to merge 1 commit into
kristerkari:masterfrom
sarathfrancis90:fix-css-transform

Conversation

@sarathfrancis90

Copy link
Copy Markdown

line-height: 1.5PX throws "Failed to parse declaration", even though font-size: 1.5PX and line-height: 1.5px both 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.

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.
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.

1 participant