When sprig, closing HTML tag in <script> get removed
See original GitHub issueDescribe the bug
When sprig
, closing HTML tag in <script>
get removed
To reproduce
Live test case: https://asiaspa.com/form?123
Simplified test case
{# text.twig #}
{% include "_script.twig" %}
{{ sprig ("_script.twig") }}
{# _script.twig #}
<span>placeholder</span>
<script type="text/javascript"><span>placeholder</span></script>
Rendered Result:
<!-- test.twig -->
<span>placeholder</span>
<script type="text/template"><p>placeholder</p></script>
<span>placeholder</span>
<script type="text/template"><p>placeholder</script>
Versions
- Plugin version:1.0.0-beta.16
- Craft version: 3.5.11.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
<script> tag doesn't close properly - Stack Overflow
The simple solution was to write a comment inside the tag so that it is not closed automatically. Silly me <script src="${jquery_url}" ...
Read more >Remove HTML Tags Using Java | Baeldung
Learn how to remove all HTML tags and extract the text from an HTML document string.
Read more >HTML script tags can not be atomic/self-closing
Recently I completed a project where I converted an Actionscript form generation system I wrote for my wife's business into Javascript.
Read more >Secure Coding Cross Site Scripting - Salesforce Developers
What is it? Cross-site scripting is a vulnerability that occurs when an attacker can insert unauthorized JavaScript, VBScript, HTML, or other active content ......
Read more >Client Side Development with Spring Boot Applications
Finally the Petclinic, while it has no Javascript, does have some client side code in ... Replace the <script> tag in index.html with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in https://github.com/putyourlightson/craft-sprig/commit/bf4a9ab7d073661d6d3b71601071a6bf02a72e64 and released in version 1.0.0-beta.17.
Your code appears to be invalid HTML so Sprig is not really at fault here. I suggest you use the template tag, which is valid HTML and works fine with Sprig.