[WIP] Fix HTML escaping and non-top-level <script> and <style> issues #1086
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ref #1082.
I'm not thrilled with how some of these changes feel. If we want to support non-top-level
<script>
and<style>
(which don't get special handling from Svelte) we're still going to have to parse them differently, since they're not HTML. Perhaps these should get their ownNode
subclass? That might not actually make anything tidier.There's also a possibility that it would be valuable to allow for
{{tags}}
in these<script>
and<style>
elements. (In this branch right now their contents are always parsed as a single string until the closing tag.) That would quite possibly be very confusing and have to come with a lot of caveats, especially in DOM mode.As it stands, the first commit here (
in stringified Text nodes, only escape &, <, >
) is the only one I feel particularly good about. There aren't even tests yet.tl;dr I still really don't know what a solution to #1082 would look like.