Closed timsnadden closed 5 years ago
Interestingly the same applies to animation-delay
.
Is this a big problem? Because if the property is invalid, it will behave the same as it's not applied which means it works the same as 0ms
.
The reason it came up for us is that we wanted to override an existing setting on hover and it didn't take effect unless the value was set with a unit ('0ms')
On Mon, 24 Sep 2018 at 19:48, Henri notifications@github.com wrote:
Interestingly the same applies to animation-delay.
Is this a big problem? Because if the property is invalid, it will behave the same as it's not applied which means it works the same as 0ms.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cssinjs/jss/issues/863#issuecomment-423897805, or mute the thread https://github.com/notifications/unsubscribe-auth/AANhZbi3Ya530UWyyMowih69v4XcO6J8ks5ueI5QgaJpZM4W2BsH .
The amount of inconsistencies in CSS is crazy.
We could just simply add units to 0
as well.
Not that simple, because some units actually require to be unitless, for e.g. opacity. If we implement #687 we will solve this issue as well.
We need to maintain 2 lists: unitless and non-px props. Ideally we should generate them from mdn data like we do for the vendor prefixer.
tbc in #687
We would just need to remove the value !== 0
from:
https://github.com/cssinjs/jss/blob/master/packages/jss-plugin-syntax-default-unit/src/index.js#L38
That would convert everything to '0'
, I would try to keep numeric values as they are where possible.
I think #687 will solve this case automatically, once it handles a unitless value with numbers and uses strings for the rest
And it would convert everything to '0ms' for example where we have a default unit. This would solve the issue.
you mean default unit? yes
I was surprised to see that browsers (tested in chrome, firefox) treat a unitless
0
value fortransition-delay
as invalid.jss-default-unit
only appends a unit to non-zero numbers leading totransition-delay
not being set when I specifytransitionDelay: 0
.