this post was submitted on 20 Jul 2024
33 points (100.0% liked)
Programmer Humor
19154 readers
2012 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm sorry Timmy but you're not allowed to have any dessert unless you close your tags like I taught you. Your grandmother was XMLish and you need to carry on our family tradition.
I thought you might do something like this so I got you a backup one from AO3.
🤓 ackshually that’s not the HTML spec. Void elements should not have trailing slashes.
https://developer.mozilla.org/en-US/docs/Glossary/Void_element
> Clicks on
<br>
> Example is
<br />
The actual thing that matters is that the
/
is ignored so (unlike with XML I believe) you can't self-close a non-void element by adding a trailing/
. But "void elements should not have trailing slashes" is extrapolation on your part; the trailing slash improves readability and is kosher since it doesn't act as a self-close.It’s not extrapolation on my part, the HTML spec is pretty direct about it:
https://html.spec.whatwg.org/multipage/syntax.html#start-tags
I don’t think it’s an extrapolation to say that code which is “unnecessary and has no effect of any kind” should be omitted.
And yeah, I linked the MDN docs because they’re easier to read but if they disagree then obviously the spec is the correct one.
To be annoyingly nitpicky, how is "unnecessary" defined in this context? Whitespace is usually "unnecessary" but I quite like it for readability.
I broadly agree with you though, the W3C spec changes things.