Forum Moderators: open

Message Too Old, No Replies

jQuery: which version should I use

swipeleft breaks with stable releases

         

csdude55

2:50 am on Jun 16, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Based on some earlier comments, I'm trying to use a more current version of jQuery than I'd originally worked with. But a problem I keep having is that the mobile swipeleft function doesn't work seamlessly across the board. I get no error messages, it just doesn't trigger anything.

I'm using this exact sample:

[api.jquerymobile.com...]

It works, but you'll see that they're not using the most stable releases.

The stable release for jQuery is 3.3.1, and for mobile is 1.4.5:

[code.jquery.com...]

But the sample is using jQuery 3.2.1, and mobile 1.5.0-alpha.1. This works, but if I use the "stable" 3.3.1 and 1.4.5, it doesn't.

I can step jQuery down to 2.2.4 (the previous stable release) and leave mobile at 1.4.5, and it does work.

So which is the better / safer / smarter / faster move? To use an older stable release of jQuery with the current stable release of mobile, or the current stable release of jQuery and the alpha release of mobile?

tangor

9:55 pm on Jun 16, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Depends on how far out on the bleeding edge you want to reside. Stable versions have one advantage: they are fully baked and won't change on you mid stream. On the other hand, alphas will expose you to potentially new stuff (that may or may not make it) in new release.

Ultimately you use what works for you RIGHT NOW so you can keep the site functioning. Failing that then what is the purpose of having a site?

Leosghost

11:19 pm on Jun 16, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have to ask..why not self host the different versions of jquery that you need, and write your code ( rename the jquery versions that you are hosting so as to avoid conflicts ..and to ensure that visitors get "your" versions) so that the various parts of it call to the versions which work for them..That is what I do..works a treat..and you are not at the mercy of an update "off site" that breaks some aspect of your site..Self hosting the versions that you need doesn't make your site slower ( except initially, and more frequently than not it is faster for a visitors browser to pull them from you than from elsewhere ) ..the fewer calls you make a visitors browser do to "off site" the more bomb prof you are..and no worries about what jquery changes are being made while you sleep that will trash your site without you knowing until you wake up.

csdude55

5:43 am on Jun 17, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Have to ask..why not self host the different versions of jquery that you need, and write your code ( rename the jquery versions that you are hosting so as to avoid conflicts ..and to ensure that visitors get "your" versions) so that the various parts of it call to the versions which work for them..

Well see, I'm in an interesting area... my target audience is relatively rural, and while some users have high speed DSL, others are in areas where the only option is dial-up. So I'm in a constant battle between offering up to date features, while at the same time worrying about the speed of the site for the slower users.

The main reason I was trying to stick with stable releases is so that the majority of users would already have it cached from other sites, so there wouldn't be any delay on that first page load on my end.

But if this is the better way to go then I might just rebuild it with the parts I need, and then do like we've talked about in earlier threads: use PHP's include to import the JavaScript on the first load, then load it separately at the bottom of the page to cache it.

QuaterPan

10:40 am on Jun 17, 2018 (gmt 0)



For production site, I can only recommend using a stable version (of anything).

If you use development/alpha/beta version, there is a risk of bugs, even if you don't see them yourself, there can also be security holes, things like that. Also, there is a risk you start using new features or functions, which, later be changed when the next stable release is published, breaking your code.

Ideally, you should write your own javascript code, without external libraries. First of all, you would have a total control of what is done and how, and don't get "surprises". Also, if I don't make mistake, Jquery without plugins, is around 30K (minified+gziped) that is huge, even if it might be already cached in the browser. You certainly do not use that much of code. (in Chrome you can see the % of javascript code downloaded vs % of code effectively used).