-
Notifications
You must be signed in to change notification settings - Fork 531
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
Spacing issues around tags with dynamic text #310
Comments
Awesome experiment, and great catch! We do nothing special for whitespace normalization currently (as you've discovered), but very solvable |
I guess the question is what is the default way for Mitosis? jsx is a fork of DOM because the DOM let's you do a lot of things so it's not strict which means you're forced to work around a lot of the allowed quirks. In jsx it's purposely a strict version of the DOM so it's a lot easier to work with in a predictable way. Mitosis can go either way of either allowing this jsx quirk since it's forcing the dev to create a text node or allow this DOM quirk of text nodes. |
Your question is a little abstract, but I will try to write my humble opinion about some concrete points, feel free to use it or not.
Please correct me if I got anything wrong. |
The line-breaks causes the browser to render spaces that were not intended to be there. Other generators also don't add these. fixes BuilderIO#310
@samijaber Awesome that there was one fix for Svelte, however this issue is concerned with more than just that. Could you reopen please ? |
@rhengles Ah right, it auto-closed. Looks like the remaining issues are in React/Solid now, where the spaces are missing |
Describe the bug
I made an extremely simple example of running Mitosis with Astro. The same Mitosis component has different rendering between frameworks. I guess we'd need a test suite for this. But below is an example:
The text of the input is rendered like this:
Note that the dynamic content is rendered on a
<span/>
tag. I could have rendered it directly on the parent text but I wanted to specifically set it apart. I think the same issue happens without the<span/>
tag.To Reproduce
If possible, a link to a https://mitosis.builder.io/ fiddle containing the bug:
There's not much point in this because the "rendered" output is a Builder editor and not rendered by the selected framework.
Link to fiddle
Expected behavior
First, I expect all frameworks to render the same. Second, I expect the spacing around texts to represent what I wrote in the source. Specifically, to have a space if there is one in the source and to not have a space if there isn't one in the source.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
No space after "Hello". Here the rendered source JSX has the word "Hello" on its own line. For it to work we need to output one of these options:
This one is actually putting a space between the
<span/>
and the exclamation mark!
. This space needs to be removed.This one actually gets it right. No complaints here
The text was updated successfully, but these errors were encountered: