Transition subvalue number compression error
Shay12tg opened this issue · 5 comments
Hi.
The compression changes 0s to 0 which is invalid in transition. for example:
transition: color 0.4s ease 0s;
will become
transition: color 0.4s ease 0;
which doesn't work
@Shay12tg did u ever fix this bug on your own? I would have figured modern browsers (ones in the last 3 years) would not have issues leaving out the "s" since 0s and 0ms is the same thing.
From my tests all indications seem to be that unitless zeros are allowed in all the popular browsers including Firefox. From my readings it was only Firefox that wasn't working but from my tests it does work. So i have to figure this can be closed since it no longer is an issue. Please correct me if i am wrong..assuming you ever return here ever again 😭
Sure I'll return :)
Just tested it myself again, latest Firefox and Chrome does NOT support 0 as a valid value for transition-duration.
You can check the CSS specs.
https://www.w3.org/TR/css3-transitions/#transition-duration
https://drafts.csswg.org/css-transitions-1/#propdef-transition-duration
The initial value for transition-duration is 0s (not 0) and the expected value type is
Time value must include a unit identifier (s or ms):
https://www.w3.org/TR/css3-values/#time-value
Changing 'ms' to 's' is great, but that`s all that should be done in transition-duration.
I don't remember if I fixed it or even where it was.....
Much appreciated @Shay12tg for the reply. Helps a lot! I will dig into the csstidy code and figure out where it's stripping it. If, however, you do remember if you had fixed it and where i'd also gladly take it -- will save me some hours hunting.
Cheers
Kimberly
Ok i believe i found the area in csstidy that will fix the problem. In class.csstidy_optimize.php (line 403) it just needs to replace:
} else {
$number[1] = '';
}
with this
} elseif ($number[1] != 's' && $number[1] != 'ms') {
$number[1] = '';
}
This would keep all existing zeros (that have their units) intact.
The fix can be found at PR #46