Skip to content

[css-lists-3] Inconsist counter() syntax between CSS 2 and 3 #5795

Open
@xiaochengh

Description

@xiaochengh

Should content: counter(c, none) be a parse-time failure, or a valid value that generates empty text?

In CSS 2.1:

  • counter() = counter(name, <list-style-type>?) [1], where
  • <list-style-type> = disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit [2]

So content: counter(c, none) is a valid declaration that doesn't generate any text. Chrome implements this behavior.

In CSS 3:

  • counter() = counter( <counter-name>, <counter-style>? ) [3], where
  • <counter-style> = <counter-style-name> | <symbols()> [4], where
  • <counter-style-name> is a <custom-ident> that is not an ASCII case-insensitive match for "none". [5]

So content: counter(c, none) is invalid at parse time. Firefox implements this behavior.

My proposal: We should not allow none. Allowing none in CSS 2.1 looks like a spec bug to me, since it provides little value and doesn't make too much sense. (And the same syntax also allows inherit, which makes no sense at all).

[1] https://www.w3.org/TR/CSS2/generate.html#counter-styles
[2] https://www.w3.org/TR/CSS2/generate.html#propdef-list-style-type
[3] https://drafts.csswg.org/css-lists-3/#counter-functions
[4] https://drafts.csswg.org/css-counter-styles-3/#typedef-counter-style
[5] https://drafts.csswg.org/css-counter-styles-3/#typedef-counter-style-name

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