Re: [csswg-drafts] [cssom] Serialization of large numbers should use scientific notation (#6471)

In terms of expected behaviors for developers, I think the current behavior for large numbers is somewhat unintuitive, as values don't roundtrip and script cannot disambiguate between two large numbers that are close to each other.

```
let value = 1000000;
document.body.style.lineHeight = value + "px";
document.documentElement.style.lineHeight = (++value) + "px";

// both '1e+06px', evals to true
document.documentElement.style.lineHeight === document.body.style.lineHeight 
```

Maybe we should specify that for numbers < X, use a set number of precision digits (in Blink I believe this is 6 currently), but numbers larger should use N precision digits where N is the number of digits (maybe +2?). Or perhaps inertia is enough that specifying the current behavior is the right call for web compat.

-- 
GitHub Notification of comment by dlibby-
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6471#issuecomment-923414974 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 20 September 2021 22:59:48 UTC