3 ms·
It is not pointless just because browsers ignore them. It’s there for humans reading the markup.
by tobr 3y ago
It is not pointless just because browsers ignore them. It’s there for humans reading the markup.
- assimpleaspossi 3y agoNo. It's not there at all. And that's the point. No one ever told anyone to put one there.
- deleted 3y ago[deleted]
- hobofan 3y agoReact popularized it, and in its context having self-closing tags on React elements to indicate leaf nodes makes a lot of sense. Prettier just went with that and also does it for HTML. I'm wondering why you are so triggered by that issue that you have to bring it up in a context where its off-topic (it could be brought up on any post related to Prettier). The validator Wiki page even highlights that it's essentially a non-issue, except for interactions with unquoted attributes, which Prettier also converts to quoted attributes, so that interaction never happens. The other reason is for "teaching the wrong" mental model, which I guess is fair from the position of MDN, but Prettier was never designed as a "teaching formatter". And if you, even with all that context want to opt-out of that formatting, there is a community-maintained plugin that adjusts the formatting to how you want it: https://github.com/awmottaz/prettier-plugin-void-html https://github.com/awmottaz/prettier-plugin-void-html
- assimpleaspossi 3y ago> it's essentially a non-issue, except for... Hope you never get tripped up by the "except for". People were mixing XML and XHTML with HTML before React and got themselves into trouble. Why are you so triggered by someone who thinks people should just follow the standard and not write unnecessary markup/code? That is a programmer's worst nightmare but people here seem to support it.