-
Notifications
You must be signed in to change notification settings - Fork 756
Description
From https://drafts.csswg.org/css-lists/#list-item,
A list item is any element with its
displayproperty set tolist-item. List items generate::markerpseudo-elements
What if you have
<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 and bug 1539267, now Firefox shows 2. item.
IMO the Firefox behavior seems confusing. Because if I have
<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.
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.