Skip to content

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

Closed
@xiaochengh

Description

@xiaochengh

The current spec 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 (s).

If difference is greater than zero, prepend difference copies of the specified 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. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions