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

Closing "</script>" tag inside a string causes ParseError #9039

Closed
Andriamanitra opened this issue Jul 25, 2023 · 1 comment
Closed

Closing "</script>" tag inside a string causes ParseError #9039

Andriamanitra opened this issue Jul 25, 2023 · 1 comment

Comments

@Andriamanitra
Copy link

Describe the bug

If </script> occurs anywhere (even inside string) in the script part of a svelte file it causes a ParseError.

<script>
  const text = "</script>"
</script>

<div>{text}</div>

A workaround I ended up using is to break up the tag, but it doesn't feel right to have to do this:

<script>
  const text = "</scr" + "ipt>"
</script>

<div>{text}</div>

Reproduction

https://svelte.dev/repl/04e7cf57836c4e22b5147a72cd62fb3a?version=4.1.1

Logs

No response

System Info

System:
    OS: Linux 6.4 openSUSE Tumbleweed 20230719
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 55.25 GB / 62.70 GB
    Container: Yes
    Shell: 3.6.1 - /usr/bin/fish
  Binaries:
    Node: 20.3.1 - /usr/bin/node
    npm: 9.7.2 - ~/Packages/npm/bin/npm
  Browsers:
    Chromium: 115.0.5790.98
  npmPackages:
    svelte: 4.1.0 => 4.1.0

Severity

annoyance

@Conduitry
Copy link
Member

This is a duplicate of #3039 / #3840 / #4406 / #4996 / #5024 / #5237 / sveltejs/rollup-plugin-svelte#133 / #5810 / sveltejs/rollup-plugin-svelte#182 / #6203 / #6366 / #6656 / #8322 / maybe others, and is not a bug. This is how parsing inline script tags works in HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants