-
Notifications
You must be signed in to change notification settings - Fork 97
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
<style> tag is emptied when javascript string contains <!-- * --> #244
Comments
I have same problem. doing something like |
<script>
const abc = "<style></style>";
</script>
<div>Hello there</div>
<style>
div {
color: green;
}
</style> E: this gives same error. https://stackoverflow.com/a/236106 hmm, it seems JavaScript and HTML itself is buggy. You should probably escape Your HTML comment inside JS string... so like this: <script>
const abc = "\<!-- javascript string --\>";
</script>
<div>Hello there</div>
<style>
div {
color: green;
}
</style> this is correct and works as expected, but I see formating remove those escape character, and at second formating, it still remove CSS: lol... Same ugly behaviour for other 2 examples. Hmm... |
<script>
const abc = "<style>";
</script>
<div>Hello there</div>
<style>
div {
color: green;
}
</style> this give error: |
<script>
const abc = "</script>";
</script>
<div>Hello there</div>
{abc}
<style>
div {
color: green;
}
</style> give error |
Bump path-parse from 1.0.6 to 1.0.7 (sveltejs#243) Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> (fix) adjust wrong "is inside other tag" check (sveltejs#247) Fixes sveltejs#244 (feat) format pug (sveltejs#248) If the pug plugin is available, format template tags with that update unreleased Integrate with `tailwind-utils` Make it work by `eval`ing TW config Install TW plugins here, otherwise they won't be found when we require things in the Tailwind config Include built plugin so we can use it without publishing to npm Remove files from package.json
So a bit of a strange one. If there is an html comment within the
script
tag, then the wholestyle
tag is just deleted when formatting.Example
test.svelte
:Output after formatting:
As you can see, the style tag is just emptied. This seems to happen whenever the pattern
<!--.*-->
is within ascript
tag.for instance works as expected and the style remains.
Personally tested with the svelte prettier plugin for vs code with auto formatting on save.
VS Code:
1.59.0
Svelte for VS Code
v105.3.4
The text was updated successfully, but these errors were encountered: