3 ms·
My favorite is how this interacts with the oh so fun mistake many people make of adding a `<div/>` thinking they are doing it right.
by taeric 9mo ago
My favorite is how this interacts with the oh so fun mistake many people make of adding a `<div/>` thinking they are doing it right.
- panzi 9mo agoEspecially since it is correct in JSX, adding to the confusion.
- jazzypants 9mo agoIt 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 9mo agoYeah, 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.