7

Ugh I hate jQuery. It's so bloated, and I can do everything I need without it. But I can't get rid of it cause WordPress absolutely needs it.

At least I can pretend it doesn't exist on my personal projects.

Comments
  • 0
    Why would WP absolutely need it..?
  • 1
    Minified and with GZIP compression on the server, Jquery clocks in at around 30 kB - I wouldn't call it bloated.
  • 0
    What can jQuery do that plain JavaScript can't?
  • 1
    @beegC0de obviously nothing because JQery is in JS. While we're at it, what can any programming language do that machine code can't?
  • 0
    @Fast-Nop sorry I meant "what can't the standard JavaScript DOM APIs do that jQuery can?"
  • 1
    @beegC0de JQuery is in JavaScript. That's why it is obvious that there can't be anything that is possible in JQuery but not in JavaScript. Just as any programming language ultimately results in executed machine code, which is why there can't be anything in any programming language that hacking in pure binary machine code can't do.
  • 0
    @Fast-Nop let me rephrase it again, "what actually IS the purpose of jQuery?"
  • 5
    @beegC0de making development easier than in plain JS. That's not quite a big deal today as a few years ago with all these browser incompatibilities back then, and CSS has also come a long way and can do things that you used to do with JavaScript, but still enough that JQuery is relevant. Not least because JQuery UI and Bootstrap require JQuery: https://remysharp.com/2017/12/...

    And if you look at http://youmightnotneedjquery.com/ , you'll find that most of the time, the JQuery way is easier to write and maintain. The cost is an additional layer and 30 kB of download, but if that is really an issue, then the website has an architecture problem other than JQuery because it would be pretty bloated and sucky with vanilla JavaScript, too.

    (Edit: unless we're talking about smallish inline JavaScript on a website that doesn't use JQuery anyway - pulling in JQuery just for a few lines would be stupid.)
Add Comment