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

Sometimes rendering static content fails #1254

Closed
dougalg opened this issue May 28, 2020 · 2 comments
Closed

Sometimes rendering static content fails #1254

dougalg opened this issue May 28, 2020 · 2 comments

Comments

@dougalg
Copy link

dougalg commented May 28, 2020

Version

3.0.0-beta.14

Reproduction link

https://github.com/dougalg/vue-bug

Steps to reproduce

Have a long string of non-reactive HTML which requires a specific parent element (eg table rows).

What is expected?

It should render the HTML

What is actually happening?

The HTML is stripped out, leaving only text.


This appears to be a bug in insertStaticContent, but the real root cause is a bug in the immplementation of innerHTML.

  1. a temporary container is created: temp = doc.createElement('div')
  2. temp.innerHTML = content is set.
  3. If the "content" is very long, AND the "temp" element is the wrong type, then the HTML is stripped from it.

This can be tested in the browser as so:

content_short = "<tr><th># of Invitess</th><td>Coming soon</td></tr><tr><th># of Discussion Topics</th><td>Coming soon</td></tr><tr><th># of Posts</th><td>Coming soon</td></tr>";
content_long = "<tr><th># of Invitess</th><td>Coming soon</td></tr><tr><th># of Discussion Topics</th><td>Coming soon</td></tr><tr><th># of Posts</th><td>Coming soon</td></tr><tr><th># of Shared Files</th><td>Coming soon</td></tr>";
tmp1 = document.createElement('div');
tmp1.innerHTML = content_long; // this fails
tmp1.innerHTML = content_short; // this works

tmp2 = document.createElement('table')
// both work
tmp2.innerHTML = content_long
tmp2.innerHTML = content_short
@underfin
Copy link
Member

#1230

@yyx990803
Copy link
Member

Closed via a938b61

@github-actions github-actions bot locked and limited conversation to collaborators Nov 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants