Hello Nicolas,
I know Hika doesn't need bootstrap. However jQuery/Bootstrap will probably exist in a Joomla 3 website, either by the template or another extension. So it is important to be able to keep the right order of the scripts in the head of the document.
But currently hikashop injects mootools in the head and disturbs the scripts order. You can see what is the final order of the scripts in the product page in my first post.
And It is not only if the template will load the other libraries, and I am not asking from hikashop to load jQuery instead of my template that makes use of it. I am just asking for hikashop to try to respect that I already use jQuery/Bootstrap.
The extensions should do their best to ensure that there will be no conflicts with the javascript and obey in the hierarchy those scripts have to be loaded.
That's why I said that it will be good to check if a website already uses bootstrap/jquery, so you can use the JHTML class to include those libraries first in your views, before injecting other JS.
Maybe it won't be that easy, or it won't give accurate results to check this from within your extension's code, but it can be just as simple as a backend "Javascript Setting" - "Does your website uses already?", with options like:
- jQuery
- Bootstrap
- Both libraries
- None
And then depending on the choice, the associated code will make sure that the right libraries will be loaded in the right order in your views.
JHTML will not load twice any library, but it will make sure that this library will be loaded before any other libraries.
This is a minimum addition (just a few lines of code, and you only have about 10-11 views in total), but will give maximum result in terms of compatibility in a complex environment with many extensions, especially since Bootstrap/jQuery will be there in the majority of the websites.
Think about it...
* Okay, we can use 3rd party plugins to set the order of the scripts in the head, but why to use plugins when something can be improved and work without such issues?