-
Notifications
You must be signed in to change notification settings - Fork 493
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
Thymeleaf not rendering HTML Boolean attribute controls
correctly for <audio>
.
#956
Comments
It appears that Thymeleaf will allow me to use the HTML form in the source code: <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="en-US">
…
<audio th:if="${audioUrl}" th:src="${audioUrl}" controls>
This browser does not support audio.
</audio>
… But now my source code is no longer valid XHTML. |
Interesting; if I do this: …
<audio th:if="${audioUrl}" th:src="${audioUrl}" th:controls="${true}">
This browser does not support audio.
</audio>
… Then Thymeleaf still renders: <audio … controls="controls">
This browser does not support audio.
</audio> So Thymeleaf must be generating the output in XHTML mode. |
I explicitly set Yet Thymeleaf still renders |
I'm reading in the latest documentation 5.5 Fixed-value boolean attributes:
It seems that Thymeleaf should already be generating |
<audio>
.controls
correctly for <audio>
.
Seeing no response here I opened a question on Stack Overflow. |
On the Stack Overflow question someone's comment made me read the documentation again, and I think perhaps it never indicated that Thymeleaf would render the natural HTML form:
Perhaps I read over this section too quickly, and interpreted the section to mean that Thymleaf understood the distinction and would be rendering the HTML form. Upon rereading it, you seem to be saying just the opposite: that Thymeleaf will render the XHTML form. |
Please note Thymeleaf's behaviour rendering this: < ... th:controls="${...}" > As this when the expression is true: < ... controls="controls" > Is perfectly valid HTML. Please review the HTML spec here. |
I understand. I just misread the documentation regarding expected behavior. Thanks for responding. |
I'm using Spring Boot 3.0.4. I have XHTML source code which includes an
<audio>
element:Note that I am using the XHTML format for a Boolean attribute
controls="controls"
. I expect the element to be rendered as HTML:But instead it renders it as an attribute with a value:
I haven't touched Thymeleaf in a while. I thought I remembered reading that it handled Boolean attributes correctly for HTML, but it looks like it doesn't, unless I made a mistake somewhere
The text was updated successfully, but these errors were encountered: