W3C home > Mailing lists > Public > www-validator@w3.org > October 2022

Re: Self closing tag error message

From: Chuck Houpt <chuck@habilis.net>
Date: Mon, 3 Oct 2022 12:18:02 -0400
Cc: www-validator@w3.org, Jon Storslee <jon.storslee@paradisevalley.edu>
Message-Id: <1404CC4E-157E-4AAD-ADAE-48ECA4C53547@habilis.net>
To: "Jukka K. Korpela" <jukkakk@gmail.com>

> On Sep 29, 2022, at 2:41 PM, Jukka K. Korpela <jukkakk@gmail.com> wrote:
> Is there a rationale for this? The “self-closing” syntax like <br/> looks perfectly harmless to me. Of course, it’s a holdover from the era when “XHTML” was popular without any good reason, but in non-XML parsing <br/> has always been read as <br>.

The main rationale seems to be that self-closing syntax interacts badly with optional attribute quoting. For example, the following causes confusion: 

<link rel=stylesheet href=/styles.css/>

Through XML-colored glasses, it may looks like it should load "/styles.css", but browsers will try to load "/styles.css/" and get a 404.

I think that self-closing tags have always been an error in HTML. The error was flagged by the HTML 2-4 validators, so this change just brings the HTML 5+ validator back in line.

- Chuck
Received on Monday, 3 October 2022 16:18:18 UTC

This archive was generated by hypermail 2.4.0 : Monday, 3 October 2022 16:18:18 UTC