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

Choose contentDOM wrapper more carefully and add display: contents #29

Merged
merged 1 commit into from
May 9, 2023

Conversation

smoores-dev
Copy link
Collaborator

There are two related issues solved by this change:

Firstly, it's possible to produce invalid (and broken) HTML with the current approach of duplicating the contentDOM. For example, if the contentDOM is a ul tag, we will currently produce <ul><ul><!-- content --></ul></ul>, which is almost certainly not desired. This PR fixes this by always choosing a div or a span (both non-semantic), and choosing which to use based on whether the contentDOM is phrasing content (meaning that it's meant to be inside of a paragraph/textblock, like a span or other inline elements).

Secondly, since this contentDOM wrapper is totally inaccessible to consumers (they can't add styles or event handlers or what-have-you to it), we make it display: contents. This allows consumers to essentially ignore it for the purposes of styling, which is great, because they don't necessarily know it exists!

@smoores-dev smoores-dev merged commit f997b0c into main May 9, 2023
@smoores-dev smoores-dev deleted the better-content-dom branch May 9, 2023 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants