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.

Textual template modes closing tag broken in 3.0.3

See original GitHub issue

The following code inside a <script type="text/javascript" th:inline="javascript"> block stopped working with 3.0.3:

/*[# th:if="${user.admin}"]*/
    alert('Welcome admin');
/*[/]*/

In fact the closing tag leaves a stale

*/

which the JavaScript parser does not like.

In 3.0.2 it works.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
danielfernandezcommented, Jan 9, 2017

Already in 3.0.4-SNAPSHOT

1reaction
danielfernandezcommented, Jan 9, 2017

Confirmed and fixed.

This was actually caused by a quite complex interaction –and quite a large amount of bad luck 😦–. As it happens, the textual parser uses buffers for parsing the textual structures (like e.g. the contents of inlined <script> tags) which size starts at 2Kbytes, and can grow during parsing if needed.

The problem however appeared when, during parsing, the parser ended the scanning of the whole 2048 bytes without finding a relevant structure to handle inside it, and at the end of the buffer it had found a text literal ("..." or '...') which wasn’t closed before the buffer ended. In such cases, this caused a sequence of bad state transitions at the parser which ended up with things like your strange */ hanging there without a reason.

So something strange, but indeed a bug. Now fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[MAJOR FEAT] New syntax for textual template modes #395
So Thymeleaf 3.0 adopts a new syntax for textual template modes, in which elements (i.e. processable tags) are declared as [#name .
Read more >
Turning off automatic tag closing in emacs web mode?
When working with HTML templates in web mode I'm frustrated by the automatic closing of tags. When inside a <div> I type </...
Read more >
HTML 5.2: 8. The HTML syntax - W3C
Tags are used to delimit the start and end of elements in the markup. ... template elements, a stack of template insertion modes...
Read more >
How to create custom template tags and filters
You can extend the template engine by defining custom tags and filters using Python, and then make them available to your templates using...
Read more >
In mustache templates are removed all closing tags
While I saw the opportunity to quickly fix the situation through the script type = text/plain templates (they work in the cache), but...
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