Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline javascript removes javascript code up to 1st ; #16

Closed
eruiz opened this issue Jun 19, 2012 · 2 comments
Closed

Inline javascript removes javascript code up to 1st ; #16

eruiz opened this issue Jun 19, 2012 · 2 comments

Comments

@eruiz
Copy link

eruiz commented Jun 19, 2012

The inline javascript removes javascript code up to 1st ;

Example;

messages.push( /*[[#{  OGNL EXPR }]]*/ );

Will output:

messages.push( 'AN STR' ;

Note that Thymeleaf removed ) that result in a not valid javascript expression.

Regards

Enrique

@danielfernandez
Copy link
Member

Hi,

This is in fact a feature, documented at the JavaScript Inlining section in the tutorials.

The aim of it is to provide a way to create JavaScript code that can be executed both statically (without executing Thymeleaf) and dynamically (after processing a template with Thymeleaf). That way:

var expr = /*[[#{ OGNL EXPR }]]*/  'This is my static expression!';
messages.push(expr);

The above code is perfectly correct JavaScript that can be executed statically. And when the template is processed, you will get:

var expr = 'AN STR';
messages.push(expr);

Nevertheless, I'm open to suggestions for new/better ways to do this (always maintaining backwards compatibility) for Thymeleaf 2.1.

Regards,
Daniel.

@eruiz
Copy link
Author

eruiz commented Jun 19, 2012

Hi,

Thanks for clarifying.

Regards

@ghost ghost assigned danielfernandez Dec 30, 2013
@danielfernandez danielfernandez removed this from the Thymeleaf 2.0 milestone Dec 27, 2020
rwinch pushed a commit to rwinch/thymeleaf that referenced this issue Dec 4, 2021
…he possibility to specify fragments in view names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants