4 ms·
No, spec authors simply added a rule to ignore the slash because Internet was full of garbage code and they realized that it is hopeless to expect low-quality f
by codedokode 2y ago
No, spec authors simply added a rule to ignore the slash because Internet was full of garbage code and they realized that it is hopeless to expect low-quality frontend developers to fix their code. There is no such thing as "self-closing element" in HTML spec (only SVG and MathML have them because they are based on XML).
Quoting the spec [1]:
> Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/), which on foreign elements marks the start tag as self-closing. On void elements, it does not mark the start tag as self-closing but instead is unnecessary and has no effect of any kind. For such void elements, it should be used only with caution — especially since, if directly preceded by an unquoted attribute value, it becomes part of the attribute value rather than being discarded by the parser.
[1] https://html.spec.whatwg.org/#start-tags https://html.spec.whatwg.org/#start-tags
- andrewfromx 2y agowow codedokode for the win!
- kiitos 2y agoYes, but that clearly indicates it's a supported syntax, which contradicts what you said up-thread. That's the only point I was making.