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

[csswg-drafts] [css-counter-styles] Change how 'pad' descriptor handles negative sign to match implementations (#5906)

From: Xiaocheng Hu via GitHub <sysbot+gh@w3.org>
Date: Thu, 28 Jan 2021 01:56:32 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-795598276-1611798991-sysbot+gh@w3.org>
xiaochengh has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-counter-styles] Change how 'pad' descriptor handles negative sign to match implementations ==
The current [spec](https://drafts.csswg.org/css-counter-styles-3/#counter-style-pad) says:

> ... If the counter value is negative and the counter style uses a negative sign, further reduce *difference* by the number of grapheme clusters in the counter style’s negative descriptor’s <symbol>(s).
>
> If *difference* is greater than zero, prepend *difference* copies of the specified <symbol> to the representation.

However, it seems that no browser is doing this. They all prepend the pad symbol to the representation until reaching the specified length, and then add the negative sign.

 For example, when using `decimal-leading-zero` (which has `pad: 2 '0'`), all browsers (I tested Chrome, Firefox, Safari) give `-01`, while the correct value should be `-1` according to the spec.

Another example is WPT [css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/descriptor-pad.html](https://github.com/web-platform-tests/wpt/blob/master/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/descriptor-pad.html). Using an extension of `upper-roman` with `pad: 3 *`, the test expects `-**I` as the representation of counter value `-1`, instead of `-*I`.

Since all existing browsers are interoperable on a different behavior, I propose changing the spec to match the existing implementations.


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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 28 January 2021 01:56:33 UTC

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