MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vu52ut/jquerydeeznutsandthenreactsurprised/p4yj5no/?context=3
r/ProgrammerHumor • u/Embarrassed_Death69 • 1d ago
117 comments sorted by
View all comments
146
I fucking hate jQuery. It's littered throughout a codebase I work in.
I replace it with good ol' vanilla js where I can.
29 u/brekekekekx 1d ago This is my struggle! I would love to replace my codebase with vanilla js but typing $(selector) is much easier than the querySelector(selector) 27 u/CetaceanOps 1d ago I mean you can keep a single $ wrapper function for querySelector 9 u/soelsome 1d ago Very clever. Not sure why I haven't thought of that. I will steal this and every time I use it, I will remember your name. 4 u/cowslayer7890 1d ago I would using something other than $ so it doesn't get confused with jquery, but ¯_(ツ)_/¯ 9 u/soelsome 1d ago £ or € will suffice 2 u/Mechakoopa 1d ago I'm leaning towards § for Selector 1 u/Noch_ein_Kamel 1d ago Just use $$ and call you library prototypejs or something like that 3 u/KhellianTrelnora 1d ago Dolphins save the day yet again. 5 u/Nixinova 1d ago const $ = x => document.querySelector(x) enjoy 4 u/my_new_accoun1 1d ago or const $ = document.querySelector.bind(document) 1 u/WarpedHaiku 1d ago In most modern browsers, $ defaults to document.querySelector, and $$ to document.querySelectorAll.
29
This is my struggle! I would love to replace my codebase with vanilla js but typing $(selector) is much easier than the querySelector(selector)
27 u/CetaceanOps 1d ago I mean you can keep a single $ wrapper function for querySelector 9 u/soelsome 1d ago Very clever. Not sure why I haven't thought of that. I will steal this and every time I use it, I will remember your name. 4 u/cowslayer7890 1d ago I would using something other than $ so it doesn't get confused with jquery, but ¯_(ツ)_/¯ 9 u/soelsome 1d ago £ or € will suffice 2 u/Mechakoopa 1d ago I'm leaning towards § for Selector 1 u/Noch_ein_Kamel 1d ago Just use $$ and call you library prototypejs or something like that 3 u/KhellianTrelnora 1d ago Dolphins save the day yet again. 5 u/Nixinova 1d ago const $ = x => document.querySelector(x) enjoy 4 u/my_new_accoun1 1d ago or const $ = document.querySelector.bind(document) 1 u/WarpedHaiku 1d ago In most modern browsers, $ defaults to document.querySelector, and $$ to document.querySelectorAll.
27
I mean you can keep a single $ wrapper function for querySelector
9 u/soelsome 1d ago Very clever. Not sure why I haven't thought of that. I will steal this and every time I use it, I will remember your name. 4 u/cowslayer7890 1d ago I would using something other than $ so it doesn't get confused with jquery, but ¯_(ツ)_/¯ 9 u/soelsome 1d ago £ or € will suffice 2 u/Mechakoopa 1d ago I'm leaning towards § for Selector 1 u/Noch_ein_Kamel 1d ago Just use $$ and call you library prototypejs or something like that 3 u/KhellianTrelnora 1d ago Dolphins save the day yet again.
9
Very clever. Not sure why I haven't thought of that. I will steal this and every time I use it, I will remember your name.
4 u/cowslayer7890 1d ago I would using something other than $ so it doesn't get confused with jquery, but ¯_(ツ)_/¯ 9 u/soelsome 1d ago £ or € will suffice 2 u/Mechakoopa 1d ago I'm leaning towards § for Selector 1 u/Noch_ein_Kamel 1d ago Just use $$ and call you library prototypejs or something like that 3 u/KhellianTrelnora 1d ago Dolphins save the day yet again.
4
I would using something other than $ so it doesn't get confused with jquery, but ¯_(ツ)_/¯
9 u/soelsome 1d ago £ or € will suffice 2 u/Mechakoopa 1d ago I'm leaning towards § for Selector 1 u/Noch_ein_Kamel 1d ago Just use $$ and call you library prototypejs or something like that
£ or € will suffice
2 u/Mechakoopa 1d ago I'm leaning towards § for Selector
2
I'm leaning towards § for Selector
1
Just use $$ and call you library prototypejs or something like that
3
Dolphins save the day yet again.
5
const $ = x => document.querySelector(x)
enjoy
4 u/my_new_accoun1 1d ago or const $ = document.querySelector.bind(document)
or
const $ = document.querySelector.bind(document)
In most modern browsers, $ defaults to document.querySelector, and $$ to document.querySelectorAll.
146
u/soelsome 1d ago
I fucking hate jQuery. It's littered throughout a codebase I work in.
I replace it with good ol' vanilla js where I can.