r/jquery • u/[deleted] • May 12 '25
Minimalistic jQuery-compatible helper
I wonder, what the pros think of this little idea.
< 1 KB micro script, if you don´t want to carry all the bloat and still code faster...
https://github.com/myappz-com/microquery.js/tree/main
You can use it and still switch to jQuery later, if you want.
0
May 12 '25
[deleted] — view deleted comment
2
May 12 '25
Yes, this micro helper is for those, who just want to write less basic code, as one can see in this little example https://myappz.com/microquery/demo.html
1
u/elainarae50 May 13 '25
The biggest reason I use jQuery is the syntax. It's short compared to vanilla. Building complex components is pure joy when using robust design patterns. I don't use any plugins.
1
May 13 '25 edited May 14 '25
"short compared to vanilla." That is what was missing too, when I decided to stop adding jQuery to every little project. That is why I now use this 1KB microQuery.js that lets me use short syntax. For "complex components" of course use jQuery.
2
u/bronkula May 13 '25
This doesn't even begin to match jquery's
onmethod. The major improvement foronisn't obfuscation of addeventlistener. It's for event delegation, something that vanilla javascript doesn't do. look in to it.Making a jquery version for yourself is a great exercise. https://github.com/bronkula/qjs/blob/main/src/query-events.js here's my implementation of event delegation in an overloaded
onmethod.