5 ms·
HTML doesn't require a closing slash, but without it needs to be context-aware and maintain a whitelist of tags that are self closing (one effect of this is tha
by underwater 8y ago
HTML doesn't require a closing slash, but without it needs to be context-aware and maintain a whitelist of tags that are self closing (one effect of this is that custom elements can never be self closing).
It's not really surprising that a developer would gravitate towards an encoding that is not dependent on maintaining a whitelist of tags, because that is the solution that intuitively feels more "correct".
- ioquatix 8y agoCompletely agree. If you want a generic parser for HTML-like tags, templates or anything where the context isn't a full HTML page, you definitely want syntactically correct/valid markup.
- Dylan16807 8y agoToo bad the closing slash doesn't do anything. <script src="..." /> will break horribly if you try to use it. Everything still depends on the whitelist.
- sureaboutthis 8y agoIf one needs a closing slash to be reminded which of the five or so tags are self closing, one has far more issues than needing a closing slash.
- anoncake 8y agoIssues like being a parser?
- underwater 8y agoMy point is that not that remembering things is hard, it's that it feels like a hack. Developers gravitate to solutions that feel elegant.
- sureaboutthis 8y agoPutting the slash in, as I said, is there for backwards compatibility only, not elegance, and it could be removed at any time since this backwards compatibility issue no longer exists, or is of minor consequence nowadays. It is far, far better to read and follow the standard specification and not follow a whim that makes you feel good. These are the things that will burn you first.