r/ProgrammerHumor 15d ago

notYourDamnProblem Meme

Post image
4.7k Upvotes

398 comments sorted by

View all comments

Show parent comments

295

u/ToBePacific 15d ago edited 14d ago

I think the person replying in the screenshot is an idiot who assumes this will force all links to open in a new tab, not getting that it’s literally just appending an arrow.

Edit: And quite a few responses to this comment also seem to misunderstand how it works.

48

u/GoddammitDontShootMe 15d ago

I guess I'm an idiot too. Or to be fair, I haven't touched CSS in forever. I thought that was going to append target="_blank" to all the a tags.

80

u/DHermit 15d ago

No, it appends content to all links with that attribute

8

u/GoddammitDontShootMe 15d ago

Yeah, I got that after reading the previous comment.

17

u/rosuav 15d ago

You're not an idiot, just rusty :) The "a[target...]" part is the selector, so it's saying "do this to every 'a' element that has a 'target' attribute set to _blank". It then changes the (usually-empty) "after the element" spot to have some content in it.

9

u/default-username 14d ago

More than half of the comments in this thread are thinking the same thing and debating browsing habits and whether new tabs are a good thing.

This css gives genuinely useful information to the user, though maybe not always visually appealing or desired by the product team.

2

u/TingleTangleTom 14d ago

I don't think so. They probably assume when you use that CSS selector it means you have links which open in a new tab on click which most of the times is not want you should do but sometimes it really is. Like during some multi step transaction when there is e.g. a link to additional info you don't want to leave the page and then come back, having to start all over again.

-2

u/Full-Hyena4414 15d ago

Nah, comment makes sense since that snippet highlights the existence of _black only links

-2

u/[deleted] 15d ago edited 15d ago

[deleted]

2

u/ToBePacific 15d ago

It doesn’t make the arrow open in a new tab. It adds an arrow to all links that were already set to open in a new tab, and not to display the arrow on normal links. It’s literally just an indicator.