W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

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

From: Chris Nardi via GitHub <sysbot+gh@w3.org>
Date: Sat, 17 Feb 2018 04:22:52 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-297977985-1518841372-sysbot+gh@w3.org>
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

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:24 UTC