572
(lemm.ee)
you are viewing a single comment's thread
view the rest of the comments
[-] xmunk@sh.itjust.works 70 points 2 years ago

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.

[-] traches@sh.itjust.works 32 points 2 years ago

🤓 ackshually that’s not the HTML spec. Void elements should not have trailing slashes.

https://developer.mozilla.org/en-US/docs/Glossary/Void_element

[-] azertyfun@sh.itjust.works 18 points 2 years ago

> 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.

[-] dukk@programming.dev 1 points 2 years ago

Trailing slash lets you do this though:

For example, in the case of <div/>Some text, browsers interpret this as <div>Some text</div>, treating the slash as ignored and considering the div element to encapsulate the text that follows.

[-] KairuByte@lemmy.dbzer0.com 5 points 2 years ago

This is terrible.

You should never rely on a browser interpreting a non standard use in a specific way. It can change at any moment, and wouldn’t be reliably reversed because it’s inherently non standard.

[-] lseif@sopuli.xyz 3 points 2 years ago

Why would you want that.

load more comments (9 replies)
load more comments (11 replies)
load more comments (14 replies)
this post was submitted on 20 Jul 2024
572 points (98.3% liked)

Programmer Humor

33743 readers
1913 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

founded 3 years ago
MODERATORS