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

[css-content] content: "" should probably generate no text nodes #9606

Open
emilio opened this issue Nov 16, 2023 · 3 comments
Open

[css-content] content: "" should probably generate no text nodes #9606

emilio opened this issue Nov 16, 2023 · 3 comments

Comments

@emilio
Copy link
Collaborator

emilio commented Nov 16, 2023

... because an empty text node would generate a baseline. Here's a test-case that shows the difference on Chromium (because Chromium has a bogus optimization that prevents an empty text node from having a layout box unless editable).

https://drafts.csswg.org/css-content/#strings is not particularly clear on what exactly the generated DOM would look like for content: "". Right now browsers differ but not generating a text node seems reasonable behavior, and we'd be willing to align Firefox with other browsers assuming the spec is updated to be explicit about this.

This came up in https://bugzilla.mozilla.org/show_bug.cgi?id=1855583

cc: @dshin-moz, @tabatkins, @fantasai

@dbaron
Copy link
Member

dbaron commented Nov 16, 2023

Hmmm. I'm not sure about your assertion that an empty text node should generate a baseline. I don't think CSS should care about text node boundaries -- from a CSS perspective the rendering should be the same no matter how many adjacent text nodes the same text is split into. And I think it follows from that that an empty text node shouldn't affect the rendering.

@Loirooriol
Copy link
Contributor

https://drafts.csswg.org/css-display-3/#intro

If the sequence contains no text, however, it does not generate a text sequence.

So if no text sequence (a.k.a text run) is generated, the baseline is not affected.

@emilio emilio removed the Agenda+ label Nov 16, 2023
@emilio
Copy link
Collaborator Author

emilio commented Nov 16, 2023

Hmm, yeah, thanks for catching that, I didn't find that piece of text :)

I was talking about existing browser behavior (all browsers seem to generate a baseline for an empty text node, if you coerce them to generate a text box).

But yeah I guess the spec is clear, and all that's left is really filing / fixing browser bugs. That said more clearly state the expected generated content would be great IMO.

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

3 participants