top | item 46519849

(no title)

panzi | 1 month ago

Especially since it is correct in JSX, adding to the confusion.

discuss

order

jazzypants|1 month ago

It doesn't help that self closing/void tags are actually a thing in HTML. input, image, meta, br-- these can be misleading to a naive developer. You can try to say something about how a div requires text content, but empty divs get used structurally by design teams all the time in practice...

panzi|1 month ago

Yeah, but these are self-closing. Writing "<br/>" is actually wrong and just corrected to "<br>" in HTML. HTML does not have that syntax, that would be XML. And that is why "<div/>" is corrected to "<div>" and the closing "</div>" is inserted somewhere.