3 ms·
To be honest this isn't that strange, the parser needs to know what denomination you're trying to subtract.. Also as per the spec the `-` operand requires a whi
by bilekas 4y ago
To be honest this isn't that strange, the parser needs to know what denomination you're trying to subtract.. Also as per the spec the `-` operand requires a whitespace. So it's not actually valid to use (100& -0) you're getting a false positive..
https://developer.mozilla.org/en-US/docs/Web/CSS/calc#notes https://developer.mozilla.org/en-US/docs/Web/CSS/calc#notes
- mrzool 4y ago> Also as per the spec the `-` operand requires a whitespace Thanks, my bad. I fixed the title.
- Izkata 4y agoBut 0 is 0 in every unit, and because of that units aren't required for 0 anywhere else.
- bilekas 4y agoIn this case though you're adding a 'special' condition for the parser/processor. Of course you could do it but as per the spec its not required - I'm just looking up the schema now to find the reference. Example is you can * no problem, its expecting only a number for the 'read_next' but with the `-' it's expecting a denomination, otherwise it needs to keep a 'state' as such when moving on from reading a `0` Edit : as pointed out by zarzavat : it does seem to be a bug in the spec in this case.
- Izkata 4y ago> Edit : as pointed out by zarzavat : it does seem to be a bug in the spec in this case. Pretty much what we're saying. It also fails when typed directly, at least in Firefox (as unnecessary as that 0 is).
- milliams 4y ago> But 0 is 0 in every unit While that might be true for all the length units defined in CSS, it's not true in general. E.g. in temperature, 0F != 0C
- bilekas 4y agoI get where you're coming from, and I think you were pedantically downvoted but it's unsafe to assume 0 as 0.. :)