You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#111900 Self closing tags and HTML5 validation

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Wednesday, 28 September 2022 16:28 BST

jjonker
Hi! Today I noticed that the W3C validor mentioning the fact that sself closig tags are 'widely discouranged':
Self-closing tag syntax in text/html documents is widely discouraged; it’s unnecessary and interacts badly with other HTML features (e.g., unquoted attribute values). If you’re using a tool that injects self-closing tag syntax into all void elements, without any option to prevent it from doing so, then consider switching to a different tool.
JCE uses the self-closing tag <br /> when a newline is used in an article or module. We have set the general settings of JCE to 'Doctype' -> 'HTML5'. So I would expect that JCE would then avoid using self-closing tags. But this is not the case. So on those tags the W3C valdator is now giving us those warnings / messages. I suppose there might be some other tags this applies to as well (img?) We also see this on <link> elements and images. (outside of JCE). So this is probably a bigger 'issue' for our sites / Joomla / template. Or maybe it's not an issue at all... But I was wondering what you think about this Ryan? I also noticed the CSS that is added get the same warning: For example:

<link href="https://www.joomlacontenteditor.net/plugins/system/jcemediabox/css/jcemediabox.min.css?0072da39200af2a5f0dbaf1a155242cd" rel="stylesheet" />

Ryan
JCE uses the self-closing tag
when a newline is used in an article or module. We have set the general settings of JCE to 'Doctype' -> 'HTML5'. So I would expect that JCE would then avoid using self-closing tags. But this is not the case. So on those tags the W3C valdator is now giving us those warnings / messages. I suppose there might be some other tags this applies to as well (img?)
These are called "void" tags in HTML 5 and refers to all tags that are self-closing, ie: do not have any content, such as ,
,
etc. I am experimenting with allowing this in JCE if the Doctype option is set to HTML 5, and will publish a beta in the next few days.
We also see this on elements and images. (outside of JCE). So this is probably a bigger 'issue' for our sites / Joomla / template. Or maybe it's not an issue at all... But I was wondering what you think about this Ryan?
Stylesheets are rendered via the Joomla API, and this using self-closing tags regardless of the doctype. https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Document/Renderer/Html/StylesRenderer.php#L190 There is currently no way I can see to override this on the template level, so this would need to be changed in the API code.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.