Swiper: Bring jQuery version back.

Created on 22 Jan 2018  路  21Comments  路  Source: nolimits4web/swiper

  • jQuery is still very popular and it is used by lots of websites including biggest content publishers.
    https://trends.builtwith.com/javascript/jQuery
  • There are also many new sites built with jQuery. (There are even progressive web apps using cheerio @ backend)
  • Saving from file size is a good thing.

Most helpful comment

jQuery itself in version 3 is not so new and most of the features in jQuery can be solved in pure ES5 and ES6. jQuery itself weighs a few hundred KB and is not the future.

So far me and others also removed the jQuery dependency in almost all projects where I contribute.

All 21 comments

jQuery itself in version 3 is not so new and most of the features in jQuery can be solved in pure ES5 and ES6. jQuery itself weighs a few hundred KB and is not the future.

So far me and others also removed the jQuery dependency in almost all projects where I contribute.

There are a lot of public/private libraries using jQuery as a dependency which are matured for long years and cannot be replaced easily. Further, jQuery is getting smaller with each new version (Already under a hundred KB). It is also modular so you can remove unneeded parts.
This is a use case feedback for maintainers.

(Already under a hundred KB).

Still too much for good performance and performance budgets in modern projects.

It is also modular so you can remove unneeded parts.

Not all, still the same since many years afaik.

I think you don't have a right to judge so easily. Please read the first sentence of my previous comment. This proposal is not about making this library jquery dependent. You can use anything you want. However, every project has it's own specific requirements. This proposal is about bringing back the swiper branch which fits better for jquery users. So let's talk about more relevant things like what it would take maintaining a jquery version of this great library. Is it too expensive? Or, is it easy?

Isn't $.fn.Swiper = new Swiper(swiperContainer, parameters) sufficient?

Is it too expensive?

Basically the double amount of effort / work.

I think you are totally out of context now. Please see swiper.jquery.js from previous versions of swiper.

eg. i'm not gonna put the jquery on the angular.
totally unnecessary.
so it is clear that vanilla js.
is to have a jquery version, double work.

For now, swiper uses dom utils from framework7. Looks like they are same as utils from jquery. Would be great if there was an option to choose which utils to use. I assume using jquery could save about 10kb of minified code

jquery could save about 10kb of minified code

And would add another 85KB minified dependency in most projects.

@danielkalen a lot of people already use jquery, why not add an option for them?

@shrpne wut?

It's very, very bad idea @hiyelbaz !!!
Try some new things buddy.

@landsman Things change. Calm down and make informed decisions.

Using any framework like jQuery instead of vanilla javascript / es6 is just lazy step in this time.

@landsman jquery is just a bunch of crossbrowser utils, maybe you will say that using lodash is lazy too? jQuery's utils are written in vanilla js, Swiper uses DOM7 utils, which are written in vanilla js too, what's the difference?
Not everyone wants to write these utils by themselves and spent time and money.
Also if every plugin will use own utils, which do the same, this could bloat overall bundle size.

@landsman jQuery has more features than $.ajax or $("div"). Depending on your project/components you may need it. Look at Twitter, Linkedin or Dropbox. They all use it. Please stop saying there is only one right way to do something. It's a sign of your projects are driven by hypes and slogans instead of tests, needs or requirements. Look at the bundlers. There were a lot of strong fans of gulp or grunt a year ago. Now there are webpack and rollup etc. Don't jump on every new hype. They are just tools. Focusing on business needs like page load time/size is more relevant.

@landsman jQuery has more than $.ajax or $("div") features. Depending on your project/components you may need it.

https://github.com/nefe/You-Dont-Need-jQuery
https://github.com/HubSpot/youmightnotneedjquery

Not really.

We are running in circles here.
The jQuery version was discontinued for many good reasons. And one reason is the extra work to manage two variants.

jQuery.ajax is for example not needed anymore as there is the native fetch API in modern browsers + very small polyfills.

Just wrap the normal script to get is as a jQuery plugin, see https://github.com/dollarshaveclub/stickybits/blob/master/src/jquery.stickybits.js

Twitter, Linkedin or Dropbox.

Not anymore as most of them switch to React and other microlibs and do not use jQuery. Would be new for me that they ever and still use jQuery.

It's a sign of your projects are driven by hypes and slogans instead of tests

Most modern projects are written in ES6 and transpiled to ES5.

There were a lot of strong fans of gulp or grunt a year ago. Now there are webpack and rollup etc.

There still are many. Also gulp 4 was finally released. And webpack is stronger than before. Rollup is for libraries, webpack for apps.

Don't jump on every new hype.

Well, that is not a hype imho ;-)

Focusing on business needs like page load time/size is more relevant.

You remember how large jQuery is and how many parts of it we do not need? And performance budgets are often critical, jQuery takes too much of it.

Since when is ES5 slower than jQuery or produce slower load times?

@nolimits4web I vote to close this issue. What do you think?

@DanielRuf So much misleading/misunderstood information here. You think most visited web applications bundle it just for fashion or they are too lazy to remove it. What's proposed here is very clear and is based on stats and daily practices.

Oh 馃槂

jQuery version was discontinued for few reasons:

  • it became less popular
  • it was buggy, as many methods didn鈥檛 work correctly with some modern stuff like flex box
  • it produced a bunch of additional issues caused, for example, by using outdated jQuery version, or because of conflict with different jQuery plugins use same extra methods used in Swiper by Dom7 like .transform/.transition
  • all this leads to my extra time which I don鈥檛 really have to check all of these issues, which I could better spent for fixing real issues it introducing new features

So my answer is no, it won鈥檛 come back ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chansecampbell picture chansecampbell  路  3Comments

Uriziel01 picture Uriziel01  路  3Comments

lxmarinkovic picture lxmarinkovic  路  4Comments

callumacrae picture callumacrae  路  3Comments

leone510es picture leone510es  路  3Comments