News for hackers. Stuff that matters.
Re:Using Standard HTML (1997) by detaro on Sunday January 19, 2020 @03:44PM (#22093923)
The self-closing form is fine in HTML5 for those examples, since they are void elements. The "/" gets ignored, which is what you want in that case.

It fails if you try this with non-void elements: E.g. XHTML <div /> might turn into <div> in HTML5, which opens a div element, which is not the same. (I'm not sure if this behaviour is specified or not)

https://html.spec.whatwg.org/multipage/syntax.html#start-tag...

> 6. Then, if the element is one of the void elements [...] then there may be a single U+002F SOLIDUS character (/). This character has no effect on void elements [...]

https://html.spec.whatwg.org/multipage/syntax.html#void-elem...

> area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr

There are no comments on this comment yet.