Preserve single quote attribute declarations
See original GitHub issueJavascript libraries are challenging us these days with their complicated syntaxes.
The following is valid XML (see point [10] of http://www.w3.org/TR/xml/#sec-common-syn):
<div data-options='{"number" : 3}'></div>
but Thymeleaf (as of 2.1.3.RELEASE) will transform it to the invalid
<div data-options="{"number" : 3}"></div>
As a workaround, a user could use
<div data-options="{"number" : 3}"></div>
or even
<div data-options="{'number' : 3}"></div>
if their JSON parser allows this syntax (not JSON standard).
As Javascript libraries are becoming more and more popular, maybe Thymeleaf should preserve the type of quotes used originally in the template.
Question asked at http://forum.thymeleaf.org/Thymeleaf-process-on-single-quoted-attributes-td4028320.html
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Preserving single or double quotes around attributes in browser
I want to preserve single or double quotes around html attributes, specifically for innerHTML within the content editable div.
Read more >Escape Single Quote in Attribute Value
Escape Single Quote in Attribute Value ... I have a flow that lists rows from a SQL table, then for each record determines...
Read more >PreserveSingleQuotes - Adobe Support
Expression that evaluates to a string in which to preserve single-quotation marks. Usage. This function is useful in SQL statements to defer ...
Read more >When to Use Double or Single Quotes in JavaScript - W3docs
Each type of quote should escape its own type. But there is no need to escape the other character inside a string. Hence,...
Read more >How to use single and double quotes in PostgreSQL - Prisma
In general, if an item is a string, it needs to be surrounded by single quotation marks. Keep in mind that when creating...
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.0-SNAPSHOT
This situation will no longer happen in Thymeleaf 3.0, as the new underlying parser (attoparser) will preserve the original state of non-processable attributes: type of quotes, specification or not of a value, etc.