-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Trailing whitespaces are trimmed from the end of inline <strong> element when page is being parsed by Vue #11122
Comments
I think #11065 pr will fix this. |
@despreston I’m not sure it’s going to solve it. The PR focuses on the template compiler if I’m not mistaken. The issue here is the DOM that Vue mounts on and parses into virtual DOM on the fly |
Hi. What's your use case of using <strong>BOLD </strong>text instead of this? <strong>BOLD</strong> text |
@Justineo Hey, You are absolutely right that it is not natural, however, our website is Vue powered and some of the website's content is UGC. Users are using some sort of a WYSIWYG and never write HTML. Because of that reason, we, nor them, have any good control of the generated HTML. We tried solving that in some ways but it looks like we couldn't achieve a satisfiable solution. |
I assume you won't need Vue to parse and compile the UGC code. You can try put a |
@Justineo I wasn't aware of the However, it is not entirely true. The way we have it working is that the user (who is not always a "random" user, but may be an editor) has a WYSIWYG where he can also "inject" custom elements which are Vue elements, such as Lead Forms. So the UGC content has Vue elements within it For example: <div id="#app">
<p>Text Text Text....</p>
<lead-form></lead-form>
<p>...</p>
<another-element></another-element>
...
</div> |
@Justineo Hey, is there anything new with that? |
Correct me if I'm wrong, but isn't skipping whitespaces default behaviour in HTML? |
Sometimes you will need something like since webpack (if I recall correctly) removes all spaces |
@s-gbz only subsequent spaces. Multiple spaces are “collapsed” into 1 space visually. In the source code you will find all of the spaces. This is obviously a bug. Webpack has nothing do to with it as we are talking about Vue mounting on an existing DOM which has never gone any compilation/transpiration step (rendered with PHP) |
Is this something I can look into? @kfirba I agree, this seems like a bug. |
After investigating this issue, I can see that it is caused by this function:
which removes ending whitespace. Does anyone know the reasoning behind this function? |
@abrahamguo anything new regarding this issue? |
Nope. I found the code for it in the core but I need the advice of people more knowledgeable than me to advise the purpose of this code. Otherwise, you could maybe dig through the history to find why this code was added. |
cccccccccc |
test |
test |
What is the status of this ticket? I have exactly the same problem with some UGC.
will be compiled to
Not the result I am hoping for. The v-pre directive does nothing and the whitespace compiler option does not have any effect. |
Going 2021 years... Without changes? |
Same issue with vue v3.5.12 using CDN So this:
is becoming:
Oddly it is keeping whitespace around the button text, but removing it elsewhere. I did find that you can do The only reason this is an issue for me is that I have a Copy HTML tool that users can copy the html code. But because of this it removes the whitespace before they can copy the code with proper indentation. Is there a way to disable this. Otherwise, am I stuck with having to add some custom indentation code when they copy the code. |
Version
2.6.10
Reproduction link
https://jsfiddle.net/kfirba2/us5h04f7/5/
Steps to reproduce
<strong>
and leave trailing whitespace at the end of it:<strong>
is removed.What is expected?
It is expected that the whitespace will remain in its place and not trimmed.
What is actually happening?
The trailing whitespace is trimmed.
The text was updated successfully, but these errors were encountered: