Different versions of jQuery


#1

Quick feedback: https://anymod.com/mod/albdkd/js and https://anymod.com/mod/albdkd are using SLIM JQUERY. This has caused severe trouble for me, as I am already using a full jQuery library. The slim.jquery still loaded additionally. That again caused me to be confronted with an issue regarding

jQuery('html,body').animate({scrollTop:0},0);

due to the fact that animate cannot be run if the slim Version is loaded. More importantly TWO jQuery libaries just should not be loaded. Does Anymod have any method in place to ensure slim.jQuery will not get loaded if the page itself does already load a jQuery libary? Is there a best practices method for me to circumvent such issues in the future?


#2

P.S. I already solved the above described issue of cause, I just wanted to let you know about it.


#3

Thanks for your feedback. This is something we have been thinking about, and we don’t have any great solutions for it. It would be possible for us to write a script that checks for jQuery on the page before loading a mod’s jQuery, though that could cause additional issues.

I think the solution might be to log a better error in the console, with suggestions for what to do. Would that be useful, or would something else be better?


#4

Totally! Error reporting in the console would totally solve the problem!

That console report might entail: information about the 2 jQuery libraries being present. And additionally all Anymod names with their SLIM jQuery library as a reference, for the developer to be easily capable to delete those slim jQuery libraries.


#5

Thanks for your feedback, I’ve added this to our roadmap :+1: