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.

unable to insert raw content into script tag

See original GitHub issue

the documentation (https://github.com/kotlin/kotlinx.html/wiki/Style-and-script-tags) says that it should be possible to insert raw content into a script tag.

This does not seem to work if I’m using the createHTMLDocument builder as then the inserted “raw” content needs to be valid XML. The example below causes a SAXParseException.

val html = createHTMLDocument().body {
            script(type = ScriptType.textJScript) {
                unsafe {
                    raw("""
                        function my() {return 1;}
                        """)
                }
            }
        }.serialize(true)

Is this intended?

I also setup a sample project to demonstrate the issue: https://github.com/abendt/kotlin-html-jscript/blob/master/src/test/kotlin/HtmlScriptTest.kt

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cy6erGn0mcommented, May 4, 2018

Fixed in 0.6.10

0reactions
abendtcommented, May 4, 2018

yes, can confirm.

thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to tell if a <script> tag failed to load - Stack Overflow
This solution works in my testing, as long as the script tag is placed directly in the document source. The document's onload event...
Read more >
Run commands on your Windows instance at launch
Learn how to run commands on your Windows instances at launch. ... <script> tag was provided.. running script content – If the script...
Read more >
Components - Astro Documentation
Astro components support adding client-side interactivity using standard HTML <script> tags. Scripts can be used to add event listeners, send analytics data, ...
Read more >
How to Add Custom JavaScript to Your WordPress Site
Even though the easiest way to add a custom script to your WordPress site is by dropping a <script> tag directly into either...
Read more >
html2pdf.js | Client-side HTML-to-PDF rendering using pure JS.
3” in npm, or use cdnjs for HTML script tags). Table of contents. Getting started. CDN; Raw JS; NPM; Bower; Console. Usage. Advanced...
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