REM-unit-polyfill
REM-unit-polyfill copied to clipboard
Values with 4 or more digits and a zero next to the dot do not convert properly
My rems are 10px. If I set a width of 80rem it converts nicely to 800px. 101.3rem converts to 1013px. 80.52rem converts to 805px.
But if I set a width of 120.8rem, it converts to 128.8px. 80.50rem converts to 80.5px.
Looks like it has something to do with the zero before the dot.
@timvandevelde I'm not able to replicate based on the use case of just the 0 before the dot. e.g.,
html {
font-size: 10px;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
line-height: 1.6;
}
.test {
background-color:black !important;
color: white;
width: 50.5rem;
height: 5em;
}
Will give me:
.test {
width: 505px;
}
Can you share your project or more specifics?
Have same issue, but in my case also 10.3rem converts to 13px
@Bartlomiejsz could you give more info on replicating this use case? I'm not finding any issues w/ the Regex offhand.
@Bartlomiejsz @timvandevelde @chuckcarpenter I had the same issue and was unable to find/fix the bug in the existing code. If you're interested in an alternative solution I wrote one here: https://github.com/nbouvrette/remPolyfill