W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2019

[csswg-drafts] [css-lists-3] Setting the start value of a reversed list (#4211)

From: fantasai via GitHub <sysbot+gh@w3.org>
Date: Sat, 17 Aug 2019 03:26:55 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-481842096-1566012414-sysbot+gh@w3.org>
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists-3] Setting the start value of a reversed list ==
Note: We currently have https://github.com/w3c/csswg-drafts/issues/4181 open on reversing the increment in reversed lists.

Currently, the suggestion for mapping HTML list numbering to CSS is that HTML injects a `counter-reset` declaration on the OL element as part of the attribute-to-CSS mapping of the HTML presentational hint cascade level. There is, however, some amount of magic: the UA has to calculate the start number and pass it to CSS as an `<integer>`, e.g. `counter-reset: list-item 4` for a 3-item reversed list.

Doing some calculations to figure out the value to pass to CSS isn't particularly unusual: for example, HTML does some special parsing of colors before passing to `color` and `background-color`, and it does some bidi calculations before passing to `direction`.

What is super magical is that these calculations are currently defined to be dependent on CSS styles, not just on the contents of the markup. See [HTML spec](https://html.spec.whatwg.org/multipage/grouping-content.html#the-li-element). In particular, [this case](http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A%3Col%20reversed%3E%0A%20%20%3Cli%3Eone%0A%20%20%3Cli%20style%3D%22display%3A%20none%22%3Enone%0A%20%20%3Cli%3Etwo%20%3Cspan%20style%3D%22display%3A%20list-item%3B%20margin%3A%201em%22%3Ethree%3C%2Fspan%3E%0A%20%20%3Cli%3Efour%0A%3C%2Fol%3E) is very strange, as not only is the `display: none` element skipped, the descendant SPAN is counted (which I personally find very surprising):

```
<ol>
  <li>one
  <li style="display: none">none
  <li>two <span style="display: list-item">three</span>
  <li>four
</ol>
```

Some options going forward include:
- A) We define the preshint mapping as `counter-increment: calc(N+1)` where N is magically calculated as defined currently.
- B) We define the preshint mapping as `counter-increment: calc(N+1)` with some reduced amount of HTML+CSS co-dependence for the counting (assuming there's a definition of that that makes sense and is Web-compatible).
- C) We define a reverse-counting counter feature, which HTML uses.
- D) Option A, but with some CSS syntax to trigger it.
- E) Option B, but with some CSS syntax to trigger it.
- F) Something else?


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4211 using your GitHub account
Received on Saturday, 17 August 2019 03:26:57 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:31:13 UTC