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

Use innerHTML in more places #3343

Closed
Rich-Harris opened this issue Aug 3, 2019 · 1 comment
Closed

Use innerHTML in more places #3343

Rich-Harris opened this issue Aug 3, 2019 · 1 comment

Comments

@Rich-Harris
Copy link
Member

Moving this from #3341. In a case like this...

<script>
  const answer = 42;
</script>

<div>
  <span class="a/{answer}"/>
</div>

...Svelte should recognise that answer cannot change, and so it's ok to use innerHTML:

-span = element("span");
-attr(span, "class", span_class_value = "a/" + answer);
+div.innerHTML = `<span class="a/${answer}"></span>`;
// ...
-append(div0, span);
@Conduitry
Copy link
Member

I believe this was fixed back with #3808 and some follow-up PRs.

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

2 participants