News for hackers. Stuff that matters.
Re:JQuery 3.4.0 Released by KajMagnus on Thursday April 11, 2019 @12:30AM (#19631173)
I migrated from jQuery to React, never going back and I wouldn't use jQuery for a new project.

I agree that jQuery is ok for simple things, however I'd probably prefer something more light weight, like Bliss.js instead. jQuery's 30kb bundle size does make pages load slightly slightly slower on mobile phones, in comparison to Bliss (about 3kb last time I checked).

Re:JQuery 3.4.0 Released by sebazzz on Thursday April 11, 2019 @12:57AM (#19631272)
Migrate from jQuery to React. You make it sound trivial but it is essentially a complete new way of developing the front-end. Not necessarily a SPA, but certainly a front-end with more interactivity than a few buttons and dialogs.

In my experience React front-ends are more driven by separate data retrieved and stored at the server, while jQuery front-ends are mostly server-side rendered and jQuery is used for some degree of dynamic flexibility.

Re:JQuery 3.4.0 Released by austincheney on Thursday April 11, 2019 @01:25AM (#19631391)
Have you considered authoring code without either of those tools? Then you can independently add in the appropriate tool to adjust for efficiency. Thinking in terms of the tooling first is premature optimization. Focus on the end product first, and the correct tooling (if any) will be clear.
Re:JQuery 3.4.0 Released by Spivak on Thursday April 11, 2019 @02:35PM (#19637728)
I honestly don't think that dev workflow is even possible with most frameworks. It's not like you can take an existing website and add interactivity or extend the existing interactivity with React.

The current landscape of web tools is pretty much that you have to call your shot from the beginning or suffer a rewrite later.

Re:JQuery 3.4.0 Released by austincheney on Thursday April 11, 2019 @10:03PM (#19641270)
That is certainly true once a framework is chosen, but before that you can prototype in many directions and extends in pieces. Extending a site to use a framework is not all or nothing.
Re:JQuery 3.4.0 Released by EB66 on Thursday April 11, 2019 @01:42AM (#19631462)
jQuery and SPAs don't have to be mutually exclusive.

At my work, we've been building SPAs with jQuery long before Angular or React even existed. More recently, we've built our own JavaScript SPA framework whose components can be written with vanilla JS or jQuery. Most of us prefer to use jQuery for our components because the syntax is often more expressive and concise than vanilla JS.

We recently open sourced the framework: http://github.com/elliotnb/nimbly

Re:JQuery 3.4.0 Released by mtzaldo on Thursday April 11, 2019 @01:38PM (#19637097)
I mixed jquery + redux. I only use those 2 libs: https://github.com/mtzaldo/jqueryredux
Re:JQuery 3.4.0 Released by baddox on Thursday April 11, 2019 @02:46AM (#19631745)
Another vote for React here. I wouldn’t let jQuery anywhere near an app I was responsibility for. It’s a great and really well thought out tool for doing things that I absolutely never ever want to do in any non-trivial app I work on.
Re:JQuery 3.4.0 Released by hpaavola on Thursday April 11, 2019 @02:22AM (#19631651)
Minified jquery (https://code.jquery.com/jquery-3.3.0.min.js) is 86 927 bytes and minified bliss (https://blissfuljs.com/bliss.min.js) is 11 823 bytes.

After gzipping those with 7-zip (on windows now, too lazy to do anything other) the sizes are 4 035 bytes for bliss and 29 495 bytes for jquery.

The same in table:

            minified    min+gzip
    jquery  86 927      29 495
    bliss   11 823       4 035
Re:JQuery 3.4.0 Released by nerdwaller on Thursday April 11, 2019 @01:09AM (#19631312)
You seem to assume that jquery isn’t already cached by the client. Given the widespread usage, while granted may be shrinking, the “bundle” may never be downloaded again; Assuming that’s the case, the download is moot, and more favorable, verses the SPA with some cache busting mechanism (that may release once per week or once per hour).
Re:JQuery 3.4.0 Released by jcutrell on Thursday April 11, 2019 @01:17AM (#19631344)
This is very rarely true, and often cited. Too many sources to get reasonable gains for cached jQuery. There was a good article breaking down exactly why this is a few years back. Mobile but someone else can probably share.
Re:JQuery 3.4.0 Released by peteforde on Thursday April 11, 2019 @01:20AM (#19631367)
As cited elsewhere in this thread, jQuery is in use on >75% of the web. The only way you don't have jQuery cached is if you don't regularly use the web.
Re:JQuery 3.4.0 Released by austincheney on Thursday April 11, 2019 @01:25AM (#19631393)
Which version cached?
Re:JQuery 3.4.0 Released by DCoder on Thursday April 11, 2019 @01:58AM (#19631542)
And from which CDN?
Re:JQuery 3.4.0 Released by GordonS on Thursday April 11, 2019 @04:40AM (#19632147)
There are only a handful of major CDNs
Re:JQuery 3.4.0 Released by extra88 on Thursday April 11, 2019 @12:07PM (#19636054)
Other sites' use of jQuery only helps if everyone is loading the same URL, which they're not. There are too many versions in too many places. I think I know the article they were thinking of, where someone tested how common it was for different sites to load libraries from the same place, it was not great.

jQuery.com doesn't mention linking to it, only downloading, and references to their CDN and other CDNs is at the bottom of their Download page. They focus on the download option probably because people generally want to have more control of their sites and would rather have "their" jQuery file be loaded from the same CDN as their site's other assets.

Re:JQuery 3.4.0 Released by KajMagnus on Thursday April 11, 2019 @05:55AM (#19632571)
Actually I did not have in mind the download time, but the time required to parse and JIT compile the jQuery code.

This was, I don't remember, something like 30 or 100 ms, for jQuery — on my core i7 laptop (according to Chrome Dev Tools). Might mean ... maybe 200 ms? half a second? on an a few years mobile phone.