Textual template modes closing tag broken in 3.0.3
See original GitHub issueThe 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:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top 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 >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
Already in
3.0.4-SNAPSHOT
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.