2. Olivier Buisard 10/11/2019
NO, jQuery is not dead
• Very popular (large community and pool of plugins)
• Ensures you write the code once for all browsers
• Use the newest features, available even for older browsers
• Requires less code to write
• Lighter library now that support for IE6-8 has been removed
4. Olivier Buisard
WHY MIGRATE?
• Preserve compatibility of old jQuery code
• Deprecated code won’t ‘break’
• Available in Joomla 3, not in Joomla 4
BUT
• Extra code to execute
• Additional library to load
10/11/2019
7. Olivier Buisard
SCRIPTS UNDER JQUERY V1.12.4
• Enable the jQuery Easy plugin
• Set jQuery to v1.12.4
• Set Migrate to v1.4.1
• Use uncompressed versions
• Check the browser console
10/11/2019
8. Olivier Buisard
SCRIPTS UNDER JQUERY V1.12.4
• Fix jQuery code
(https://github.com/jquery/jquery-migrate/blob/
1.x-stable/warnings.md)
• Disable Migrate
• Test the site
10/11/2019
9. Olivier Buisard
SCRIPTS UNDER JQUERY V3.4.1
• Set jQuery to v3.4.1
• Set Migrate to v3.1.0
• Use uncompressed versions
• Check the browser console
10/11/2019
10. Olivier Buisard
SCRIPTS UNDER JQUERY V3.4.1
• Fix jQuery code
https://github.com/jquery/jquery-migrate/blob/
master/warnings.md
• Disable Migrate
• Test the site
10/11/2019
13. Olivier Buisard
AVOID SCRIPT ISSUES IN JOOMLA
• Identify extensions needing jQuery
• Is your template using jQuery (Bootstrap? yes!)
• Turn off jQuery in extensions if parameter
• If other libraries are present, use jQuery.noConflict()
• Identify which Bootstrap version your template is using
10/11/2019
14. Olivier Buisard
AVOID SCRIPT ISSUES IN JOOMLA
• If MooTools is present, try identify why it is necessary on
the page
• Overuse the browser console (great for CSS too!)
10/11/2019
15. Olivier Buisard
AVOID SCRIPT ISSUES IN JOOMLA
• Make sure the code is encapsulated correctly
10/11/2019
$(document).ready(function(){
$("div").hide(); // picked up by jQuery and MooTools
});
jQuery(document).ready(function($){
$("div").hide(); // picked up by jQuery only
});
16. Olivier Buisard
AVOID SCRIPT ISSUES IN JOOMLA
10/11/2019
var $j = jQuery.noConflict(); // Use jQuery via $j(...)
$j(document).ready(function(){
$j("div").hide();
});
jQuery.noConflict()(function(){ /* code using jQuery */ });
(function($) { /* some code that uses $ */ })(jQuery)