You have a point and it is attractive, but I think a tool that reformats HTML should not change its actual meaning, the result should render the same way as the input unless explicitly asked. The original page could have been tested and a difference would be surprising.
It’s because the trailing “/“ has zero semantics now, by definition. You can add or remove it from any tag, and it doesn’t change the meaning of your HTML.
<div/>
some text
is thus equivalent to
<div>
some text
which in the absence of any further tags or content is interpreted as
<div>
some text
</div>
(Note however the exception for foreign content like SVG, as noted in the article.)
A td element's end tag may be omitted if the td element is immediately followed by a td or th element, or if there is no more content in the parent element.
Edit: I don't know the "div" rules. Don't see that here.
Edit2: I'm actually curious on if what I put here is wrong.
Sorta? The thread was about how odd it is that <div> has implicit end tags?
So, makes sense that the topic seems different, but it is the explanation for why a div grows to contain everything under it. For example, this is needed to know why the div in the following text closes.
Right? I get that the original confusion is thinking you can make a self closing div. But the fact that it expands to cover things that come after it requires you to know about the implicit closing. Hard to understand one without understanding the other.
Edit: I suppose it would be better for me to say that none of the examples on the immediate parent post are different, because none of them close the div? It isn't that the one div expands to cover everything after it, is that nothing caused it to be closed. Indeed, if those are just snippets from a document, you can't be sure that stuff that comes after it is also not included in the div.
If I understand it correctly, The `<foo />` syntax is an XML invention. It was never added to HTML. Traditional HTML parsers see the slash as a malformed attribute and ignore it, and that behavior was codified in HTML5.
The whole "we want to look like XML, but not /be/ XML" has to be one of the most annoying aspects of it. I shouldn't be too surprised on this particular edge, but holy crap I also wouldn't be shocked to know that I did it wrong in some pages.
I would tend to agree, which is why I made this suggestion. I think it's much more likely that what was meant is to insert an empty tag, even if that's not how browsers would interpret it.
It could be an option though.