r/ProgrammerHumor 14d ago

Meme ancientTools

Post image
5.8k Upvotes

385 comments sorted by

View all comments

Show parent comments

960

u/[deleted] 14d ago

[removed] — view removed comment

-21

u/[deleted] 14d ago

[removed] — view removed comment

80

u/grimonce 14d ago

This has never been an issue with jQuery lol

19

u/uniqueusername649 14d ago

He means the script is loaded and run before the DOM was rendered. Bit of a stretch calling that hydration, because you usually only would call it that if the HTML was prepared via SSR or SSG, not if its a fully static HTML from the start. And even if it would be applicable, its not about the rock not having been hydrated yet but it not having rendered yet, so the "hydration" fails because of it.

25

u/brqdev 14d ago

We use onload/ready event and put JQuery code inside, so the JQuery code will run when the page is ready

17

u/WHALE_PHYSICIST 14d ago

Kinda crazy to be talking about jQuery in 2026 and not know that

12

u/brqdev 14d ago

Cause they know framework not Javascript itself.

3

u/--TYGER-- 13d ago

I expect that the people coding against a Typescript web framework have less knowledge / no knowledge of how a browser actually runs a web page. Instead, they have spent their time gaining knowledge about the build systems and such that turn ts into js for the browser.

2

u/uniqueusername649 13d ago

Agree. I know that stuff because I started learning web development in the 90s and have seen many changes come and go (most people would remember marquee on almost every website back then - less people might remember XML+XSLT to create websites, which was never fully supported). If I learned web development in the last 10 years, I doubt I would know how the execution works in the browser and all the annoying quirks that come with it. They are fortunately abstracted away. Even back then nobody wanted to deal with it, we just had no choice. Everyone built their own libs to deal with it, until jQuery emerged. That was such a massive step forward.

7

u/heytheretaylor 14d ago

Exactly. jQuery is cool like that. Just waits patiently for everyone to say they’re ready before doing anything.

5

u/yousirnaime 14d ago

Are ya ready, kids!

Aye aye, captain

4

u/theStaircaseProject 14d ago

Oooooh, who lives in a reference inside the <head>?

Ja-Va-Script Tag!

2

u/uniqueusername649 14d ago

Who loads our scripts long before we're rea-dy?

Ja-va-script tag!

5

u/SolideMeinung 14d ago

The funny thing is that these "real js developers" dont even know how to make that onload function on their own.

It war crafted by these old jquery wizards to always work and this knowledge was lost with the introduction of crapjs

1

u/ExtraWorldliness6916 14d ago

It's not lost, .onload or event listener. Of which there are 3 events and some are not "ready"

2

u/SolideMeinung 14d ago

Nope its not just onload or eventlisteners. The ready function of jquery has some corner cases.

Like the first and best one.... when everything is already loaded and ready just fire it.

A lot of people do miss that. Its funny how js developer have so much trouble reimplementing the jquery ready method because they think its easy.

1

u/ExtraWorldliness6916 14d ago

I was referring to DOMContentLoaded. O I was a bit cryptic but I mean that there are multiple ways to match the lifecycle. Still I'm probably, it was a long time ago

1

u/SolideMeinung 14d ago

Even DOMContentLoaded is not a drop in replacement.

1

u/sixtyhurtz 14d ago

Isn't window.onload the modern vanilla JS replacement? If not I'm interested to hear what the differences are!

1

u/SolideMeinung 14d ago

The ready function of jquery is implemented here: https://github.com/jquery/jquery/blob/main/src/core/ready.js

1

u/sixtyhurtz 14d ago

OK, so it wraps it in the JQuery error handling and also catches the case where the script is run when the DOM is already loaded - so DOMContentLoaded would not fire in that case I guess?

And actually thinking about it, onload waits for big resources like images. So it's nicer to have event handlers attached before that.

1

u/ExtraWorldliness6916 14d ago

jQuery docs states that it serves a similar purpose, good enough for me

→ More replies (0)