Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

[css-display][css-pseudo] Is ::marker created by display:list-item or does it always exist? #1793

Closed

Description

@Loirooriol

::before and ::after pseudo-elements always exist in the element tree, but most times they don't generate boxes in the box tree because content computes to none by default.

Is it similar for ::marker pseudo-elements? Do they always exist, but they only generate boxes if the display of the originating element has the list-item keyword? Or do ::marker pseudo-elements only exist if the originating element has the list-item keyword?

CSS Display handwaves the difference between the ::marker pseudo-element and the marker box generated by it, so it's not clear. CSS Pseudo isn't clear either.

The difference matters because Firefox and Chrome allow ::marker pseudo-elements to be originated by some tree-abiding pseudo-elements. So if ::marker always exist, this could potentially mean that the element tree has an infinite depth, which doesn't sound much right.

I see various possibilities:

  • ::marker pseudo-elements are only created when display has the list-item keyword.
  • ::marker always exist but are only originated by elements, ::before, and ::after. They can't be originated by other ::marker.
  • ::marker always exist but are only originated by elements. Like ::before and ::after, they can't be originated by other pseudo-elements. This would be a breaking change for Firefox and Chrome.
  • ::marker always exist and can be originated by elements or any tree-abiding pseudo-elements. The element tree has an infinite depth, but in practice this isn't much problematic because the box tree is finite.

Activity

  1. tabatkins commented on Sep 11, 2017

    @tabatkins
    Member

    Ah, I was inclined to say they always exist (but only generate boxes when display:list-item on the originating element), but your point about infinite trees is well-taken. (I mean, the element tree isn't observable, so it being infinite but only being allowed to generate finite box trees is theoretically okay, but awkward to talk about.)

    I mean, ::marker pseudos can't ever generate meaningfully generate more ::markers, because they don't accept display. We could make that more explicit when talking about the implicit generation.

  2. tabatkins commented on Sep 11, 2017

    @tabatkins
    Member

    So, uh, your option #4 or #2 seems best. I don't like #1, because it means that element tree shape is only fully determined after the cascade, resulting in (theoretical) nested cascades to assign styles to the newly-created ::marker pseudos.

  3. Loirooriol commented on Sep 11, 2017

    @Loirooriol
    ContributorAuthor

    About #4, I thought that CSS debugging tools that expose the element tree might prefer it to be finite. However, they annoyingly tend to hide tree-abiding pseudo-elements that don't generate boxes, so maybe they don't care.

  4. Loirooriol commented on Sep 15, 2017

    @Loirooriol
    ContributorAuthor

    I have been thinking that the element tree already depends on the cascade because of content.

    If you have ::before { content: 'foo'; display: table }, the text foo can't be directly inserted into the box tree as a text run, because it would not be clear into which of the two boxes generated by pseudo-element it should be inserted. Instead, the text should be inserted as a child text node in the element tree, and then CSS Display determines that the generated text run needs to be inserted into the table box.

    So if content is able to affect the element tree, I guess display: list-item could too.

  5. tabatkins commented on Mar 19, 2018

    @tabatkins
    Member

    Discussing with @fantasai, we agree that option 2 is best (::marker always exists, but can only be originated by elements, ::before, and ::after (and future pseudos of similar style)).

    Agenda+ for verification from the WG.

  6. frivoal commented on Mar 20, 2018

    @frivoal
    Collaborator

    I agree option 2 makes the most sense.

  7. dbaron commented on Mar 20, 2018

    @dbaron
    Member

    I would prefer limiting ::marker to elements that have display: list-item. Checking for pseudo-elements can be somewhat expensive, and I'd rather not have to check everything for ::marker all the time.

    I don't have a strong opinion on whether ::marker should be attachable to other pseudo-elements that have display: list-item. (I don't think you should be able to make a ::marker display: list-item, and Tab agrees above, so I don't think there's an issue with nesting ::marker once it's restricted to list-item.)

  8. FremyCompany commented on Mar 23, 2018

    @FremyCompany
    Contributor

    This specification defines a new type of pseudo-element, the ::marker pseudo-element, which is generated by list items to represent the item’s marker (the bullet or number identifying each item).
    The ::marker pseudo-element is only created on list items. On any other element, the ::marker pseudo-element’s content property must compute to none, which suppresses its creation.
    https://www.w3.org/TR/css-lists-3/#marker-pseudo-element

    ^ FWIW I'm fine with that, and didn't see a strong reason why we would want to change it.

  9. FremyCompany commented on Mar 23, 2018

    @FremyCompany
    Contributor

    By the way, @tabatkins argument against 1 doesn't speak much to me because we insert the list-item bullet (or a proxy for it) in the first line box of the list-item to make sure its line-height is big enough to render the marker properly. So, in effect, we already have a requirement to wait for full cascade to entirely determine the tree in Edge and Chrome.

  10. tabatkins commented on Mar 23, 2018

    @tabatkins
    Member

    Yeah, ::marker is definitely still limited to just list-items; it's suppressed otherwise.

  11. css-meeting-bot commented on Apr 12, 2018

    @css-meeting-bot
    Member

    The Working Group just discussed Is ::marker created by display:list-item or does it always exist?, and agreed to the following resolutions:

    • RESOLVED: marker exists on all elements, on ::before and on ::after but no box unless it's display: list-item
    The full IRC log of that discussion <dael> Topic: Is ::marker created by display:list-item or does it always exist?
    <dael> github: https://github.com//issues/1793
    <dael> TabAtkins: We all agree on overall behavior. More a question what model we want. Marker pseudo element. Original question is decided. It was what things in theory can have marker pseudo elements. It's only created by thing with display list item. Theoretical model of the element tree, which things have the display list item.
    <dael> TabAtkins: We wanted approval that marker elements always existing hte box tree on eleemnts before or after and they're auto surpressed.
    <dael> TabAtkins: Other options are if they exist in the tree depends on style or say they always exist but not on elements but not on pseudo elements ::before or ::After which breaks the current behavior for FF and Chrome.
    <dael> TabAtkins: Final option is marker elements always exist and can be on any tree abiding elements. This could mean that market pseudos contain marker pseudos. Because you can't set display on them you'll never see them.
    <dael> TabAtkins: Depends on the theoretical model you want.
    <dael> emilio: Is that required? Except for slotted I think most browsers reject pseudo elements at parsing time.
    <dael> TabAtkins: Does not require that.
    <dael> TabAtkins: That would be good if you actual style mested marker.
    <dael> emilio: It would mean you can set content-before.
    <dael> TabAtkins: Ideally you should be able to, but right now you have an unstylable marker.
    <dael> dbaron: Auto-surpressed?
    <dael> TabAtkins: Like how ::before doesn't create a box unless it's non-none. Marker wouldn't have a box unless it's contents had display.
    <dael> dbaron: Is there a distinction between exists and surpressed and not existing?
    <dael> TabAtkins: One is a layer violation. It requires us to not completely build on the tree until we resolve the styles. Right now we can build the element tree fully. This is theoretical design and has no practical considerations.
    <dael> TabAtkins: We suggest they always exist on elements, ::before and ::after
    <dael> fremy: is that all browsers do?
    <dael> TabAtkins: THose are all that browsers have always there. If we add more we can categorize properly.
    <dael> TabAtkins: Objections to my preferred option that marker exists on all elements, on ::before and on ::after but no box unless it's displayed.
    <dbaron> s/displayed/display: list-item/
    <dael> florian: If you display list-item...the initial value of content is normal then you get it but if you don't display list item is it like a ::before?
    <dael> TabAtkins: It does not show up.
    <dael> Rossen: Obj?
    <dbaron> sounds good to me
    <dael> RESOLVED: marker exists on all elements, on ::before and on ::after but no box unless it's display: list-item
  12. 11 remaining items

  13. added this to the TPAC-2020-08-23 milestone on Oct 16, 2020
  14. tabatkins commented on Oct 23, 2020

    @tabatkins
    Member
    • I'm ambivalent about whether ::marker::marker is invalid. I'm inclined to say it's "valid but never matches anything", but I can easily go either way.

    • Yes, we should explicitly prevent ::marker from having display: list-item in the future; computing it to flow makes sense to me. There is no reasonable use-case for making the marker of a list item be a list item. ^_^

  15. Loirooriol commented on Oct 23, 2020

    @Loirooriol
    ContributorAuthor

    If ::marker::marker is invalid.

    That's what Chromium does, if you enable experimental flags, the parser accepts ::before::marker and ::after::marker but ::marker::marker is invalid (https://wpt.fyi/results/css/css-pseudo/parsing/tree-abiding-pseudo-elements.html).

    If in the future we allow display to apply, do we force it to compute list-item to flow?

    Seems reasonable. Or more precisely, I would just remove list-item from the computed value. So flow-root list-item would become flow-root, not flow.

  16. css-meeting-bot commented on Oct 23, 2020

    @css-meeting-bot
    Member

    The CSS Working Group just discussed Existence of ::marker::marker, and agreed to the following:

    • RESOLVED: ::marker::marker is invalid
    • RESOLVED: accept proposal above
    The full IRC log of that discussion <fantasai> Topic: Existence of ::marker::marker
    <fantasai> github: https://github.com//issues/1793
    <fantasai> https://github.com//issues/1793#issuecomment-708072107
    <RRSAgent> I have made the request to generate https://www.w3.org/2020/10/23-css-minutes.html fantasai
    <florian_irc> scribenick: Florian
    <florian_irc> fantasai: This is a follow to previous decisions on ::marker
    <florian_irc> fantasai: we didn't want to have infinite markers
    <florian_irc> fantasai: so you cannot have ::marker::marker
    <florian_irc> fantasai: right now ::marker doesn't accept the display property
    <florian_irc> fantasai: so, is ::marker::marker invalid?
    <florian_irc> fantasai: and, in the future, if we want to allow that
    <fantasai> s/that/display on ::marker/
    <florian_irc> fantasai: then, do we force it to compute display so that it loses its list item
    <florian_irc> Rossen_: so, taking things one at a time, should we allow ::marker::marker
    <florian_irc> fantasai: I'd like to make it invalid
    <florian_irc> TabAtkins: browsers don't support it
    <tantek> +1 on no ::marker::marker
    <florian_irc> oriol: implementations are behind flags, so not too relevant
    <florian_irc> oriol: in firefox, no nested pseudos
    <florian_irc> oriol: in chrome ::before::marker and ::after::marker work, but ::marker::marker doesn't
    <florian_irc> oriol: but then the styles don't quite work anyway
    <florian_irc> oriol: so I'd prefer to keep it invalid
    <florian_irc> Rossen_: any objection to ::marker::marker being invalid
    <florian_irc> RESOLVED: ::marker::marker is invalid
    <florian_irc> fantasai: in the future, when display applies to ::marker, should it lose the list itemness
    <florian_irc> oriol: seems reasonable
    <florian_irc> Rossen_: me too
    <florian_irc> RESOLVED: accept proposal above
    <TabAtkins> ScribeNick: TabAtkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions