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

[selectors][css-text] ::after-letter(an+b) or ::before-char() #10898

Open
Crissov opened this issue Sep 16, 2024 · 2 comments
Open

[selectors][css-text] ::after-letter(an+b) or ::before-char() #10898

Crissov opened this issue Sep 16, 2024 · 2 comments

Comments

@Crissov
Copy link
Contributor

Crissov commented Sep 16, 2024

There have been several proposals for text or character matching pseudo-elements, e.g. #3208, which is computationally expensive, in the past, but as far as I can see there is no proposal yet for a simpler pseudo-element that is inserted before or after the nth ”letter“ or rather character.

One (weak) use case for this are indicators for boundaries, e.g. where you would need to split a text to fit it into, e.g., 140-, 160- or 280-char messages.

@Loirooriol
Copy link
Contributor

What if the element contains a mix of text and children elements? Would you keep counting letters recursively into the children and insert there? What style would it use then, the one from the pseudo-element, the one from the nested element, or a broken mix like ::first-line?

Also, I suspect authors will commonly want to skip trimmed whitespace rather than just counting unicode code points. And possibly count combined characters as a single one?

@Crissov
Copy link
Contributor Author

Crissov commented Sep 16, 2024

Those are all valid points, of course, since this is not a fully thought-through proposal but more of a shot from the hip so the idea gets tracked at all.

I guess this should be somewhat aligned with #2208 `::text``.

I think the distinction between letter and char or character would mostly be just that: ignore whitespace or don't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants