thymeleafjs icon indicating copy to clipboard operation
thymeleafjs copied to clipboard

th:if fails to parse equality against a literal string

Open abousta opened this issue 4 years ago • 1 comments

Hello

Can't parse th:if="${value=='a string'}"

Steps to reproduce :

  • Go to test/standard/processors/IfAttributeProcessor.js and run the test named "Renders the element and children if the expression is truthy" --> Success
  • Change let expression = '${value}' into let expression = '${value==\'str\'}'
  • Few lines below, in the test data, change value: true into value: 'str'
  • Run the test --> Error: Failed to parse "${value=='str'}"

Regards

abousta avatar Jan 19 '22 16:01 abousta

Note that an alternative syntax like th:if="${value}=='a string'" (ie test condition outside of brackets) works fine

abousta avatar Jan 19 '22 17:01 abousta