Closed Bug 593739 Opened 14 years ago Closed 14 years ago

Implement some equivalent of ::-moz-list-bullet for numbered lists (ordered lists, ol > li)

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: tonymec, Unassigned)

References

()

Details

(Keywords: dev-doc-complete)

RFE: Implement some equivalent of :-moz-list-bullet for numbered lists

Rationale: With existing CSS (including both W3C CSS3 Draft Recommendation [and earlier ones] and -moz- extensions as documented at MDC), it is extremely difficult (and ugly) to style the numbers in front of the lines of ordered lists.

Example: I wanted to have the numbers (but not the list-items themselves) in bold, without losing the possibility to have lists numbered in digits subordinate to lines of a higher-level list numbered in Roman numerals. If ::-moz-list-bullet (or some equivalent) had applied not only to unordered lists but also to ordered lists, it would have been easy (and elegant), as follows:

ol.outer { list-style-type: upper-roman }
ol > li::-moz-list-bullet { font-weight: bold }

(Instead of "bullet", which is somewhat counterintuitive for numbered lists, something else, such as maybe ::-moz-list-index or ::-moz-list-numbering, but *documented*, would of course have been OK.

Instead of that, here are the hoops I had to jump through:

ol
 { list-style-type:     none
 ; counter-reset:       list
 }
ol > li::before
 { font-weight:         bold
 ; counter-increment:   list
 }
ol.outer > li::before
 { content:             counter(list, upper-roman) ". "
 }
ol:not(.outer) > li::before
 { content:             counter(list) ". "
 }
li
 { padding-left:        1em
 ; margin-left:         1em
 ; text-indent:         -1em
 }
ol ol > li
 { padding-left:        0.25em
 }

Ugly, isn't it? And the complexity of the solution makes me uncertain of having tested all the edge cases.

Additional info:
* ::-moz-list-bullet is documented at https://developer.mozilla.org/en/CSS/%3a-moz-list-bullet
* Gecko extensions to CSS have a table-of-contents at https://developer.mozilla.org/en/CSS_Reference/Mozilla_Extensions — see in particular the section "Pseudo-elements and pseudo-classes".
We already have ::-moz-list-number as a parallel to ::-moz-list-bullet.

That said, I wouldn't encourage use of either of these in Web content.

We should implement ::marker at some point, which is the hopefully-soon-to-be-standard form.  That's bug 205202.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WORKSFORME
(In reply to comment #1)
> We already have ::-moz-list-number as a parallel to ::-moz-list-bullet.

Well, maybe we do, but it is undocumented, which means it's as good as nonexistent:
- No mention of it on the "Mozilla CSS Extensions" TOC page linked near the end of comment #0
- If I replace %3a-moz-list-bullet by -moz-list-number preceded by either one or two occurrences of %3a in the :-moz-list-bullet URL, also mentioned near the end of comment #0, I get an empty page (and an edit form) in both cases.

I'm not yet adding it, because:
1) This way you can see it's missing;
2) I don't know whether it's desired to have one or two colons before -moz- in the URL.

> That said, I wouldn't encourage use of either of these in Web content.

In this case, it is in a series of pages held on a file:/// location, probably never to be published (but who knows?). The choice to make them incompatible with Konqueror would have been, well, a choice, and not to be made lightly, but I prefer SeaMonkey anyway (and the version I'm, er, testing is built on the Gecko 2.0 beta "trunk" code).

> We should implement ::marker at some point, which is the
> hopefully-soon-to-be-standard form.  That's bug 205202.

Thanks for the heads-up.
You need to log in before you can comment on or make changes to this bug.