Skip to content

[css-display] ::marker is not a box #1625

Closed

Description

@Loirooriol

From Generating Marker Boxes,

The list-item keyword causes the element to generate a ::marker pseudo-element box

::marker is a pseudo-element which may generate a box. But it can also generate multiple boxes or no box. I think it should say something like

The list-item keyword creates a ::marker pseudo-element which generates boxes as if it were an immediate child of the element

And consider linking CSS Lists Markers, because CSS Pseudo-Elements Markers seems obsolete.

Activity

  1. SelenIT commented on Jul 20, 2017

    @SelenIT
    Collaborator

    Could you please show an example when ::marker generates multiple boxes? Something like display: list-item for the marker itself? By the way, if this is allowed, should that marker of the marker pseudo element be also styleable (with the chain of pseudo elements like ::marker::marker or something)?

  2. Loirooriol commented on Jul 20, 2017

    @Loirooriol
    ContributorAuthor

    I think styling ::marker with any display value which generates multiple boxes in normal elements should do the trick. For example, display: table generates a table wrapper box and a table box. Yes, styling it with list-item should generate a 2nd ::marker pseudo-element nested inside the 1st one, this already works with ::before and ::after on Firefox and Chrome (fiddle) so I don't see why it shouldn't work with ::marker.

    However, I think I read implementations don't want to allow arbitrarily deep structures of pseudo-elements, because that's expensive. So just like you can't insert a ::before inside another ::before, you can't style a ::marker inside a ::marker.

  3. Loirooriol commented on Jul 20, 2017

    @Loirooriol
    ContributorAuthor

    This quote from Introduction should be edited too:

    some display values (e.g. display: list-item) generate more than one box (e.g. a principal block box and a marker box)

    I guess saying this "marker box" concept is a reminiscence from CSS 2.1, which didn't allow to style the ::marker pseudo-element, so it always established a single box. This could still apply with the very limited ::marker defined in CSS Pseudo, but it does not work with the full-fledged ::marker defined in CSS Lists. I'm assuming the last one is the good definition.

    About the quote in Introduction, I would just use another example. An element can originate a pseudo-element which can generate boxes, so saying that these boxes are originated by the element itself is not entirely wrong. But I would prefer not to say so; otherwise #1604 would worsen, because an element is not supposed to generate more than one principal box.

    Instead, the example could mention display: table with its table wrapper box and table box, or display: block ruby with its block container and ruby container.

  4. Loirooriol commented on Jul 22, 2017

    @Loirooriol
    ContributorAuthor

    After I filed this issue, CSS Lists was edited. Now it says that the whole spec is not ready for implementation and ::marker has been restricted back to what CSS Pseudo says, properties that affect box characteristics like display are no longer accepted. So if it exists, ::marker will generate a single box, and thus I guess CSS Display may stay as it is. It can also be edited so that if the ::marker restrictions are relaxed in the future (which I hope will happen), the spec will still make sense.

  5. tabatkins commented on Jul 24, 2017

    @tabatkins
    Member

    Yeah, I just moved the warning from being manually added to a few sections to being generated by Bikeshed; the spec hadn't been seriously edited for years and wasn't using the newer Bikeshed features.

    ::marker has been restricted back to what CSS Pseudo says, properties that affect box characteristics like display are no longer accepted.

    Yup, Pseudo reflects the current WG consensus on what ::marker should be allowed to do, so I'm just deferring to that. It's basically "what have people actually asked to do with markers", or "what can you currently do to markers by abusing inheritance and wrappers" (setting a style on the list item, then unsetting it on a wrapper around the list-item's contents).

    There's no problem with relaxing it in the future, there's just no call for it currently. If you want to do arbitrary things, you have ::before. You can even use position: marker with ::before once that's implemented, to get it to exactly mimic an outside marker.

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions