[css-syntax] Do not require digits after decimal point for number tokens

I’m not sure if this is even feasible at this point, but in case it is, here goes:

My proposal is to allow decimal points without digits after them so that CSS like the following is valid:

font-size: 1.em;
line-height: 1.;

It would still change the type to "number", just step 4 of [1] would be reworded to "If the next input code point is U+002E FULL STOP (.), then:"

The reasoning is that currently there are many tools around that let authors edit CSS code and see the result in real time, including (but not limited to) browser debuggers. When the author is editing non integer lengths (e.g. from 2.5px to 2.9px), it usually goes like this (| denotes the caret):

2.5px|
2.5|px
2.|px
2.9|px

Instead of being able to observe the result of their changes, all they see is a flash, since the 3rd step makes the value invalid, then it jumps back to 2.9px. It sounds trivial, but it’s encountered so frequently that it’s incredibly annoying.
Not allowing such numbers is also inconsistent with Ecmascript, where numbers like 5. are perfectly valid.

~ Lea

[1]: http://www.w3.org/TR/css3-syntax/#consume-a-number0

Received on Tuesday, 29 July 2014 19:20:24 UTC