question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When sprig, closing HTML tag in <script> get removed

See original GitHub issue

Describe 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:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

2reactions
bencrokercommented, Sep 25, 2020
1reaction
bencrokercommented, Sep 24, 2020

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.

<template><p>placeholder</p></template>
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found