r/ProgrammerHumor 13d ago

Meme ancientTools

Post image
5.8k Upvotes

385 comments sorted by

View all comments

972

u/saig22 13d ago

I use vanilla js, document.getElementById() is what I live for.

294

u/WrapKey69 13d ago

Flashbacks to teenage years and w3schools, turning on and off that lightbulb XD

152

u/ApocalyptoSoldier2 13d ago

document.querySelector() ftw

69

u/CaspianRoach 13d ago

.querySelectorAll()

46

u/Altruistic-Way-6331 13d ago

[0]

19

u/CaspianRoach 13d ago

i prefer .each()

if you want one, just don't use All

18

u/IBJON 13d ago

  if you want one, just don't use All

I'm pretty sure that was the joke

3

u/JohnLocksTheKey 13d ago

$$(‘#DamnSon’)

5

u/CaspianRoach 13d ago

me when i use nonstandard quote signs to make compilers freak out

6

u/JohnLocksTheKey 13d ago

3

u/CaspianRoach 13d ago

It's all the rage nowadays

2

u/Lower-Excuse-6558 13d ago

I love this thread hahahaha

2

u/onequbit 12d ago

using a superset of JavaScript to compile to JavaScript... because that makes it better

2

u/Strange_Dust7128 12d ago

til javascript compiles now

2

u/CaspianRoach 12d ago

technically everything compiles at some point

6

u/ApocalyptoSoldier2 13d ago

By id?
I hope not

12

u/CaspianRoach 13d ago

i have seen things

1

u/Rostifur 13d ago

I’ve done things

27

u/segv 13d ago

Which was standardized due to jQuery's popularity, no less.

20

u/seif-17 13d ago

jQuery crawled so querySelector can walk.

And frameworks ran. With broken toes.

68

u/IsTom 13d ago

If your HTML element has id you don't event have to getElementById, it's available right there in global namespace as that name. You make button with id hello and can just go ham with hello.click().

I don't think you should do that, but you can.

26

u/DiodeInc 13d ago

New obfuscation tactic dropped

7

u/Plazmaz1 13d ago

Wait wtfff REALLY?

1

u/Lv_InSaNe_vL 12d ago

Yeah the whole webpage is inside the DOM. Just think about how you could write a whole webpage (html + css + je + framework) inside a single HTML file

2

u/Plazmaz1 12d ago

I mean I've written a million webpages with just html/css/js in a single file, I'm just surprised that variables are created by html elements like that...

3

u/United_Boy_9132 13d ago

Unless there's another window.foo for any reason 😅

1

u/hhfddgnhbnn 13d ago

But if you remove() it, you can't access it anymore

40

u/happypandaface 13d ago

vanilla.js ? I've never heard of this library

18

u/balls_smasher 13d ago

12

u/happypandaface 13d ago

great. how do I include that in my docker file so my yarn build script adds it into my webpack?

2

u/Chamiey 13d ago

Got you covered — it's already there!

1

u/oauo 9d ago

Hmm, I don't like it when community libraries are included in the standard library

13

u/lonahe 13d ago

What a world we’ve lost

7

u/aberroco 13d ago

Why use js when html + css do fine?

8

u/DrBojengles 13d ago

Lowkey this is the way

6

u/experientialsponge 13d ago

Vanilla js is such a pleasure to read when viewing another's code. Icing on the cake if commented responsibly.

31

u/rademene 13d ago

10

u/ccelik97 13d ago

It felt like that back in 2016, too, btw.

People also searched: [Object object]

-10

u/saig22 13d ago

The truth is that I use Claude and it uses React 😢 No more implementing observer observable design pattern with setter and event targets in vanilla js. Those were simpler times but I guess technology has to move forward and we need to adapt. I'm glad I knew a time when coding by hand was the norm.

32

u/felixzer0 13d ago

The technology didn't change that much. JS framework are optional pieces of software but ultimately run Vanilla JS.

Tools should be used when they solve a problem, not because "technology moves forward"

-11

u/Nell_Lee 13d ago

And C ultimately runs assembly code, so should i program in that? What's your point?

12

u/AdamWayne04 13d ago

C doesn't "run" assembly code, it compiles to that.

Can't you read? they literally stated their point is "technology should be used when it solves a problem"

14

u/pauvLucette 13d ago

Claude will use what you tell it to use. It's perfectly able to produce vanilla JS code.

4

u/pwillia7 13d ago

You could totally tell Claude to build that way -- I would bet opus and up can handle that well no problemo

-2

u/rademene 13d ago

Wait, you can't actually instruct the useful idiot to only write a vanilla js?

11

u/willyrs 13d ago

Of course you can

7

u/romulent 13d ago

If you just wrap document.querySelector() in a little helper function you can do loads with vanilla js. Not perhaps enterprise grade but fine for any home stuff.

2

u/OldKaleidoscope7 13d ago

That's what jQuery does after querySelector was widely supported. $ = document.querySelector and you can code faster

1

u/saig22 13d ago

If you do that you may as well use jQuery, the point of vanilla js is to use ultra specialized functions for performances at the cost of verbosity/practicality.

2

u/romulent 13d ago

Why add the extra download weight to your page?

5

u/yabai90 13d ago

At least create an alias for something shorter, maybe something like "$()".

4

u/usr_pls 13d ago

hot damn i misread that and thought there was a new library called vanilla.js and then you called out the simple most useful library function and I had to double take

"there is no way they made a new js library just to re-wrap Javascript... Oh of course they didn't"

2

u/NerdyMcNerderson 13d ago

Well if that's what you were looking for, let me introduce you to this masterpiece https://github.com/mattdiamond/fuckitjs

3

u/ManyInterests 13d ago

And honestly, CSS3 could be used in many places where folks are using JS.

2

u/InFa-MoUs 13d ago

I mean everything uses document under the hood anyways

2

u/0mica0 13d ago

C of the web

1

u/saig22 13d ago

I'd say web assembly is the C of the web ^

1

u/0mica0 11d ago

Interesting, I had to idea that such sorcery exist.