[csswg-drafts] [cssom] How should extremely small <number>s be serialized?

csnardi has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom] How should extremely small <number>s be serialized? ==
According to https://drafts.csswg.org/cssom/#serializing-css-values:

> A base-ten number using digits 0-9 (U+0030 to U+0039) in the shortest form possible, using "." to separate decimals (if any), rounding the value if necessary to not produce more than 6 decimals, preceded by "-" (U+002D) if it is negative.
> 
> Note: scientific notation is not used.

However, what should this return? (see https://jsfiddle.net/ko5k3uxx/1/)

```
div.style.opacity = "1e-8";
div.style.opacity;
```
In Firefox, the answer is `1e-8`; in Chrome,  `1e-08`; and in Edge, `1e-008`. Clearly, scientific notation is being used, but even if it wasn't, the correct answer per the spec would probably be `0`, if I read that text correctly (it should probably be reworded, as decimals is slightly unclear -- I assume it means "numbers after the decimal point"). However, this wouldn't round trip the value.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2330 using your GitHub account

Received on Saturday, 17 February 2018 04:23:03 UTC