You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enable processing of HTML event handler attributes in JAVASCRIPT template mode #707
...could benefit from their values being considered inlined javascript blocks just like the bodies of <script th:inline="javascript"> tags. This would allow its contents be applied all the features, including security benefits, made available by Thymeleaf to inlined JavaScript code (including JavaScript-text-literal escaping).
So such an event handler could now be written as:
<ath:onclick="doSomething([[${textdata}]]);">
And the code above, if textdata has the value One "JavaScript" message will result in, first, the textdata variable being output as a JavaScript literal (and therefore escaped) as "One \"JavaScript\" message", and then the whole value of the HTML attribute being HTML-escaped as expected:
Note this new feature will alleaviate the restriction on the evaluation of variables in these handlers imposed by means of #705, while protecting from unintented output of JavaScript-unescaped data that might not be trustable.
Activity
Fixes #707 - Enable processing of HTML event handler attributes in JA…
danielfernandez commentedon Jul 23, 2018
Already in
3.0.10-SNAPSHOTAdded tests for thymeleaf/thymeleaf#707
Added tests for thymeleaf/thymeleaf#707
Added tests for thymeleaf/thymeleaf#707
Added tests for thymeleaf/thymeleaf#707
Added tests for thymeleaf/thymeleaf#707
Added tests for thymeleaf/thymeleaf#707
Fixes thymeleaf#707 - Enable processing of HTML event handler attribu…