Changes in the HTML spec keep us on our toes if we use the W3C validator, so how do we deal with the latest one that produces numerous "Info" messages on an otherwise valid page? The resulting "Trailing slash on void elements has no effect and interacts badly with unquoted attribute values" is triggered by any linked asset, be they favicons, webmanifests, meta tags, linked css stylesheets, and any images of whatever format.

What had been a valid page for me now throws 53 such info messages. (See https://validator.w3.org/nu/?showsource=yes&doc=https%3A%2F%2Fwww.rob-tomlinson.com%2F). Your website will no doubt produce similar results. It's global!

screenshot 1
Screenshot of part of the W3C validator's output
Screenshot of another part of the W3C validator's output

Simple question: are there any changes to Backdrop code or settings (here using 1.24.0) that can remove these trailing slashes?

Accepted answer

Thanks, @trapeharde32, for raising this! We discussed it at the 3/16/2023 Backdrop design meeting, and there is now an issue for it in the Backdrop issue queue.

 

Comments

quicksketch's picture

Hi @trapeharde32!

@bugfolder brought up this topic during the weekly developer meeting (towards the 40 minute mark of the video): https://www.youtube.com/watch?v=dElPbYlX0iA

The general items mentioned in the video:

  • I don't think we have the ability to suppress trailing slashes through a setting currently. It may be possible through overriding templates(?)
  • You may be able to get your site passing the W3C validator without errors by specifying an XHTML-compatible doctype.
  • I think moving Backdrop core towards removing trailing slashes by default is good idea. We need to do further research as to why the HTML spec moved towards removing trailing slashes by default and use that as justification for Backdrop changing its default output.

Big thanks to @quicksketch and @bugfolder for responding and for taking time during the design meeting to give this careful consideration. Interesting discussion you had. I'll be interested to see where this now goes.

I recognize that I speak as something of a standards fanatic - which may not be a widely shared perspective - but having Backdrop generate fully standards-compliant code has always been a big plus point. Maintaining that (without info messages) would retain the lead that this exquisite CMS has. (Has anyone ever seen a WordPress site pass validation?)