? Failure

User tests: Successful: Unsuccessful:

avatar okonomiyaki3000
okonomiyaki3000
1 Oct 2014

It's silly to use three http requests to load the basic jQuery framework files. Just combine them and load with a single request. So there are four possibilities:

  • jquery.js - just jQuery
  • jquery-noconflict.js - jQuery + no conflict
  • jquery-migrate.js - jQuery + migrate
  • jquery-noconflict-migrate.js - jQuery + no conflict + migrate (usually this is used)

Each of them also has a minified version. Depending on the options passed, one of these files will be chosen and only it will be loaded. No need to load three files.

avatar okonomiyaki3000 okonomiyaki3000 - open - 1 Oct 2014
avatar jissues-bot jissues-bot - change - 1 Oct 2014
Labels Added: ?
avatar wilsonge
wilsonge - comment - 1 Oct 2014

I don't think this works. Because in many template frameworks people override the jQuery file. If you do that but have the jQuery + migrate file loading suddenly you have two jquery files being loaded

As well practically I think this is a bad idea because we now have to update jQuery in 3 different places (6 if you include the minified versions) which is just asking for issues in the future

I agree having 3 http requests is non-sensical and something we should look to deal with in the future. But I don't think we can solve it b/c in 3.x - probably in 4 we should do this except do it in the build script or similar?

avatar wilsonge
wilsonge - comment - 1 Oct 2014

OK RE: above of course you don't have 2 jQuery files being loaded but the template override now fails which means you could have a different version of jQuery being loaded - which is just as bad.

avatar brianteeman brianteeman - change - 1 Oct 2014
Category JavaScript
avatar okonomiyaki3000
okonomiyaki3000 - comment - 2 Oct 2014

I guess it depends on how jQuery is being overridden. There are several ways to do it with varying degrees of rightness. It seems to me that the most correct way is to actually override override the JHtml 'jquery.framework' function so that it loads whatever you want it to load, or nothing at all if you don't want to use jQuery. I don't think this causes a problem for any but the most wrong ways of overriding. People should avoid doing things the wrong way.

I agree that a build script would make maintaining these files a bit simpler but I don't think they get changed that often anyway.

avatar davidtranhp
davidtranhp - comment - 3 Oct 2014

there are many ways to reduce http requests. In this case, I would prefer to use a Joomla plugin (which could be found in JED) to do the job, or just build my apache/nginx server with pagespeed support to have minified and combined css and js

avatar Hackwar
Hackwar - comment - 3 Feb 2015

Please fix the codestyle and unittest errors that Travis is complaining about.

avatar mbabker
mbabker - comment - 27 Jun 2015

I can't say I fully agree with us manipulating the distributed files from a vendor, even if it's combining things into one file. IMO this is best left to a site implementor to decide on and not a core responsibility.

avatar wilsonge wilsonge - close - 27 Jun 2015
avatar wilsonge wilsonge - change - 27 Jun 2015
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2015-06-27 22:03:38
Closed_By wilsonge
avatar wilsonge wilsonge - close - 27 Jun 2015
avatar Bakual
Bakual - comment - 28 Jun 2015

It seems to me that the most correct way is to actually override override the JHtml 'jquery.framework' function so that it loads whatever you want it to load

If you onyl want to change the version of jQuery, putting your own version into the correct override place in your template will be the simplest and most correct thing to do. Michael wrote once an excellent artiicle (https://www.babdev.com/blog/139-use-the-media-folder-allow-overridable-media) on his blog about that. No need for messing with JHtml at all.
@wilsonge is right that your PR would break that.

avatar okonomiyaki3000 okonomiyaki3000 - head_ref_deleted - 29 Jun 2015

Add a Comment

Login with GitHub to post a comment