News for hackers. Stuff that matters.
Re:A summary of jQuery method alternatives in native browser... by grabcocque on Friday March 31, 2017 @05:32AM (#14002254)
Why use JQuery when you can do it in a way that's more ugly, more verbose, less portable, more likely to break?
Re:A summary of jQuery method alternatives in native browser... by metalelf0 on Friday March 31, 2017 @05:37AM (#14002284)
This is exactly what I came here to type. Or, you can take all the vanilla js snippets, wrap them into a shorter notation... and build your own jQuery, just with less portability. I don't get the point of this.
Re:A summary of jQuery method alternatives in native browser... by fiiv on Friday March 31, 2017 @05:47AM (#14002330)
JQuery is massive and has a lot of functionality. Sometimes this is nice, but sometimes all you need from it is a small part of that whole. I think the point of that link is that if you are looking to build in some simple functionality like hide and show an element when someone clicks a button, then you do not really need to include the whole JQuery library just to do that because then the massive library is not being used and you would be better served to write your own vanilla function.

I don't see anything wrong with that. No one is saying that JQuery sucks or that it should die, I think the point is more "use the best tool for the job".

You can buy a massive wrench with all kinds of adjustable settings and addons and stuff but if all you ever need is an Alan key, then maybe the little one that comes with your IKEA furniture is actually better and easier to use than that massive wrench.

Re:A summary of jQuery method alternatives in native browser... by Jazcash on Friday March 31, 2017 @06:11AM (#14002419)
30KB after being minified and gzipped is massive to you?
Re:A summary of jQuery method alternatives in native browser... by lucideer on Friday March 31, 2017 @06:14AM (#14002429)
Yes. This comment is why Wirth's law is a thing.
Re:A summary of jQuery method alternatives in native browser... by drinchev on Friday March 31, 2017 @05:51AM (#14002348)
No jQuery actually means:

1. Less dependencies for your JavaScripts

2. Less "magic" behind the scenes

3. Native JS-engine optimisation

4. Switch of though-process ( jQuery, although quite flexible ), makes you think that everything is "string", "array", "object" and sometimes you need the bare Node-element e.g. https://developer.mozilla.org/en-US/docs/Web/API/Element

Re:A summary of jQuery method alternatives in native browser... by squeral on Friday March 31, 2017 @06:03AM (#14002393)
You can always use TypeScript if you want your code to look prettier and more verbose.
Re:A summary of jQuery method alternatives in native browser... by zepolen on Friday March 31, 2017 @05:36AM (#14002279)
Mostly agree, but there are use cases like performance where it's best to go as low level as possible.