Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out some way to trigger ::marker without being a list item #6781

Open
tabatkins opened this issue Oct 29, 2021 · 5 comments
Open

Figure out some way to trigger ::marker without being a list item #6781

tabatkins opened this issue Oct 29, 2021 · 5 comments
Labels
css-pseudo-4 Current Work

Comments

@tabatkins
Copy link
Member

In #6738, @MatsPalmgren brings up a perf issue they noticed where a document with a ton of summary elements becomes extremely slow, because each of them touches the list-item counter due to being display: list-item (because we're using ::marker to display the disclosure triangle).

The perf problem is tangential (it applies to any enormous list), but in that issue Mats correctly points out that the fact we're using display: list-item at all is pretty hacky. For context, this was decided on back in 2016/2017, in a conversation spanning implementors, WHATWG editors, and CSSWG editors. It didn't have a great motivation behind it other than it seemed to work reasonably well and didn't involve us inventing anything new.

That said, maybe we should invent something new? I do wonder if this is compat-bound by now, tho.

@tabatkins tabatkins added the css-pseudo-4 Current Work label Oct 29, 2021
@MatsPalmgren
Copy link

There's also no reason why the list-item keyword should be restricted to inline/block layout. A list item should be able to have any display type IMO. That's a separate issue, but probably worth addressing at the same time since generalizing ::marker gives you 95% of the implementation for that.

@tabatkins
Copy link
Member Author

I agree, but note we skipped that originally based on the impl complexity of supporting ::marker on arbitrary display types.

(Tho we already support ::before and ::after on literally everything; iirc these do require special handling and it's not just a matter of "adding one more name" to the existing machinery.)

@MatsPalmgren
Copy link

FYI, I implemented a working prototype for that in 2019 in Gecko. At that time, I also implemented table-caption and table-cell as outer display values so that they could have arbitrary inner layout, like grid and flex. I seem to recall that I commented on a csswg issue at the time that all this was fairly easy to support in Gecko. It must have been some other vendor that was the source of the "impl complexity" assessment.

Anyway, I'd be happy to dust off those patches if the csswg is interested in moving forward on this topic...

@fantasai
Copy link
Collaborator

Three possible ways forward here:

  • Introduce a new keyword to display that acts like list-item but doesn't touch the list-item counter, e.g. marker-item or something.
  • Have ::marker { content: anything-except-normal-or-none } trigger creation of a marker box. (This is slightly complicated by the fact that ::marker { content: normal } needs to create a marker box when attached to a list item.)
  • Address the perf problem by setting counter-increment to a value that explicitly doesn't touch the list-item counter.

@Loirooriol
Copy link
Contributor

I'm afraid that by now there will be various sites using ::marker { content: "> " } as a synonym of list-style-type: "> ", and generating a marker for non-list-items will be bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-pseudo-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants