W3C home > Mailing lists > Public > public-css-archive@w3.org > January 2021

[csswg-drafts] [css-syntax][cssom][css-values] Asymmetry of parsing and serializing numbers (#5880)

From: Bernhard Fey via GitHub <sysbot+gh@w3.org>
Date: Tue, 19 Jan 2021 13:04:51 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-789006091-1611061490-sysbot+gh@w3.org>
bernhardf-ro has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-syntax][cssom][css-values] Asymmetry of parsing and serializing numbers ==
According to [[css-syntax]4.3.12.](https://drafts.csswg.org/css-syntax/#consume-number)&[4.3.13.](https://drafts.csswg.org/css-syntax/#convert-string-to-number) as well as [[css-values]5.](https://drafts.csswg.org/css-values-4/#numeric-types) numbers are parsed and processed with the maximum possible precision.
However, [[cssom]6.7.2.<number>](https://drafts.csswg.org/cssom/#ref-for-number-value) specifies a maximum precision of 6 digits (7th for rounding) for serialization.

So serializing and re-parsing can change values. For example, JavaScript modifications of style sheets can have unexpected and unavoidable side-effects.

_To demonstrate a worst-case_: `image-orientation:44.99999deg` computes to _0deg_, but after serialization and re-parsing computes to _90deg_, as it was rounded to `45deg`.

_So the question is_: Should parsing also limit precision or is there a different solution?

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 19 January 2021 13:06:15 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:25 UTC