4 ms·
It's insane, and thanks for the tip. Nit: we don't use HTML like it's 2005 anymore. So instead of <input type="..." /> with bogus XHTML-like slash at the
by tannhaeuser 6y ago
It's insane, and thanks for the tip.
Nit: we don't use HTML like it's 2005 anymore. So instead of
<input type="..." />
with bogus XHTML-like slash at the end, just use
<input type="...">
Sorry, but it's a pet peeve of mine to point out cargo-cult idioms like that. The slash at the end was there to make your HTML parse as XML/XHTML. But unless you have very specific requirements (like serving your page as XHTML, or fruitlessly attempt to produce or parse your HTML using an XML toolchain) we don't do that anymore, even in 2019. The slash and the pretentious-looking space before it is ignored/error-recovered away by browsers and other HTML parsers anyway.
- themoose8 6y agoGetting off topic now, but I like those, and still practise it. It lets the reader know not to expect a seperate closing tag.
- asiando 6y agoI’m not gonna expect </img>, but thanks for the concern.
- bottled_poe 6y agoI’ll do what the linter says thanks.
- asiando 6y agoThat’s backwards
- malf 6y agoThis is probably jsx, and the slash is required.
- Doctor_Fegg 6y agoHow can a space be pretentious-looking?!
- Freak_NL 6y agoTakes up space without adding any substance. Jokes aside, that space before the / exists as a habit because Internet Explorer couldn't handle tags like <br/>, so in order to have valid XML that worked in IE as well you would do <br />. Completely pointless nowadays of course, although I do like the / for single elements. It's kind of nice to be able to write HTML5 and XML both with roughly the same syntax.
- bobince 6y agoOh it's older than that, even. IE was always fine without the space. It was for Netscape. So, sure, maybe there's a good reason to want XML-compatible syntax. But Netscape 4 users? Let's hope not!
- saagarjha 6y agoWho are you to tell people they can't live in an idealistic world where the documents we send each other have a standard behind them that isn't special-cased for the laziness of years of web developers?
- tannhaeuser 6y agoI'm the one working hard to debunk the misconception that HTML is "sloppy" or XML in any way adds standardization to HTML that wasn't there already with SGML. [1]: http://sgmljs.net/docs/sgml-html-tutorial.html http://sgmljs.net/docs/sgml-html-tutorial.html [2]: http://sgmljs.net/blog/blog1701.html http://sgmljs.net/blog/blog1701.html
- flagrant 6y agoSelf closing tags are perfectly valid in HTML 5 and there's nothing wrong with using them. Even if the parser ignores them, they're still useful for the reader. HTML 5 does not require you to close your paragraph tags either but most people still do it because tag soups are hard to understand.
- ljm 6y agoThis has to be one of the most absurdly elitist (or patronising?) comments about HTML I've had the pleasure of reading. Who is this 'we' you speak of?