Closed xiaochengh closed 3 years ago
The padding doesn't take into account the prefix and suffix either, so it may be reasonable to ignore the negative sign too.
I guess that the syntax of pad
could always be extended in the future, so that authors can specify whether they want to include the prefix, negative sign or suffix.
I'd rather figure out if we can change browser to match the spec, first - I doubt there's compat impact, and the current specification is written the way it is for a reason: so both positive and negative numbers end up the same length, and thus (assuming a monospace font) the same width, which is the entire point of using the pad descriptor in the first place.
Agenda+ to confirm whether we're okay with leaving the spec as it is, or if we should adjust for bugwards compat.
The CSS Working Group just discussed [css-counter-styles] Change how 'pad' descriptor handles negative sign to match implementations
, and agreed to the following:
RESOLVED: Leave the spec as it is and have browsers fix the bug
@xiaochengh The CSSWG discussed this issue in https://lists.w3.org/Archives/Public/www-style/2021Jun/0005.html and concluded on leaving the spec as-is for the reasons described by @tabatkins in https://github.com/w3c/csswg-drafts/issues/5906#issuecomment-770123158 (and the minutes). Let us know if this response is satisfactory!
(Somehow missed this one...)
Thanks for resolving! The resolution looks good to me.
The current spec says:
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 haspad: 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. Using an extension of
upper-roman
withpad: 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.