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

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