e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

weird behaviour of e107::js() #4013

Open Jimmi08 opened 4 years ago

Jimmi08 commented 4 years ago

This is more about testing and how it works.

With theme_library

$libraries['cdn.jquery'] = array();
$libraries['jquery'] = array();

no jquery should be loaded.
But with new theme, e107_web/lib/jquery/2.2.4/dist/jquery.min.js is always there.

I wanted to find a place where this happens because it worked with my other site before.

I know the reason now. It's caused with e_module.php in the social plugin (on my other site wasn't installed)

This line of code causes that local jquery is loaded. e107::css('social', 'css/fontello.css');

Of course, when you use core libraries, it's probably overridden later with CDN version or something like that, but loading css file shouldn't cause inserting jquery.

Thanks

PS. You can test this with die() in class2.php after loading e_modules (cca line 819) and print input parameters in e107_class.php js() method.

Alex-e107nl commented 4 years ago

Thx Jimmy, i had seen it to but could not find where it was triggered... hope it can be solved..

Jimmi08 commented 4 years ago

next is raty.js loaded in the header_default.php. It depends on jquery, so it's loaded automatically. Maybe.
And because JQuery is not loaded in non-conflict mode, I gave up.

// Allow other JavaScript libraries to use $.
// TODO: Use jQuery.noConflict(), but for this, need to rewrite all e107 javascript to use wrapper: (function ($) { ... })(jQuery);
// jQuery.noConflict();
Moc commented 4 years ago

@lonalore Any ideas?

CaMer0n commented 4 years ago

@Moc jQuery is required for a lot of core functionality, so what is being suggested would just create more bugs if it actually 'worked'.