[csswg-drafts] [css-lists] Can replaced elements be list items? (#4633)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-lists] Can replaced elements be list items? ==
From https://drafts.csswg.org/css-lists/#list-item,

> A list item is any element with its `display` property set to `list-item`. List items generate `::marker` pseudo-elements

What if you have

```html
<ol>
  <svg style="display: list-item"></svg>
  <li>item</li>
</ol>
```

The `<svg>` has `display: list-item`, but it's a replaced element, so it can't originate a ::marker pseudo-element inside. Then, should we still consider it to be a list item that increments the `list-item` counter?

In Chromium it's not considered to be a list item, so it shows `1. item`. This also used to be the case in Firefox until [bug 288704](https://bugzilla.mozilla.org/show_bug.cgi?id=288704) and [bug 1539267](https://bugzilla.mozilla.org/show_bug.cgi?id=1539267), now Firefox shows `2. item`.

IMO the Firefox behavior seems confusing. Because if I have

```html
<ol>
  <div style="display: none">
    <svg style="display: list-item"></svg>
  </div>
  <li>item</li>
</ol>
```

then the `<svg>` still has a computed `display` value of `list-item`, but now it shows `1. item` like Chromium. So it's not just checking the computed `display`, I guess it's also checking for [being rendered](https://html.spec.whatwg.org/multipage/rendering.html#being-rendered).

For me it makes more sense to require list items to be non-replaced elements. Then (assuming you are not preventing the ::marker from generating boxes via `list-style-type` or `content`), if there is a marker box then it means it's a list item, otherwise it's not.

CC @MatsPalmgren @emilio @fantasai 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4633 using your GitHub account

Received on Sunday, 29 December 2019 17:55:06 UTC