jQuery purpose on frontend

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

jQuery purpose on frontend

Post by Don Chambers »

I have a scenario where the version of jQuery packaged with 2.0 (1.11.2) is breaking something in a theme of mine that jQuery included in 1.7.8 (1.8.3) did not.
  • What does jQuery do on the front end?
  • Can we specifically tell s9y to NOT load jQuery, so a theme can load a specific version of jQuery, different from what s9y would use on the front end?
  • I know I can load an older version of jQuery since s9y is using no-conflict, and this actually solves my problem. Is there a huge down side to this?
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: jQuery purpose on frontend

Post by yellowled »

Don Chambers wrote:What does jQuery do on the front end?
Various plugins (lightbox comes to mind) and themes (2k11, for instance) use it in their JS. jQuery itself does not do anything since it's a library.
Don Chambers wrote:Can we specifically tell s9y to NOT load jQuery, so a theme can load a specific version of jQuery, different from what s9y would use on the front end?
Yes. Set $serendipity['capabilities']['jquery'] = false; in your config.inc.php, bundle your own jQuery version (but set noConflict mode for that as well for plugins to work properly).
Don Chambers wrote:I know I can load an older version of jQuery since s9y is using no-conflict, and this actually solves my problem. Is there a huge down side to this?
Yes. You would be loading 2 versions of the same library which means an extra http request, about 95KB loaded unneccessarily and a very bad practice. Also, you're gonna get laughed at. :wink:

The best solution would really be to fix whatever is not working with jQuery 1.11.2 any longer. This is most likely related to something in the theme's JS (or maybe a jQuery plugin used in the theme) that was deprecated in jQuery between 1.8.3 and 1.11.2. Does it give you any error message in the browser's JS console?

YL
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: jQuery purpose on frontend

Post by Don Chambers »

yellowled wrote:The best solution would really be to fix whatever is not working with jQuery 1.11.2 any longer. This is most likely related to something in the theme's JS (or maybe a jQuery plugin used in the theme) that was deprecated in jQuery between 1.8.3 and 1.11.2. Does it give you any error message in the browser's JS console?
Yeah, I know. It is not the theme's own JS, it is an included jQuery plugin that I have to update.... and really didn't want to update!! :|
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: jQuery purpose on frontend

Post by Don Chambers »

Have we ever used < jQuery 1.7 on the front end? 1.7.8 used jQuery 1.8.3.
=Don=
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: jQuery purpose on frontend

Post by yellowled »

Yes. The first jQuery ever to be bundled with the s9y core was 1.4.4.

https://github.com/s9y/Serendipity/comm ... /jquery.js

YL
Post Reply