User tests: Successful: Unsuccessful:
Both component and module search results were affected.
jquery.autocomplete.min.js was loded before jQuery
Labels |
Added:
?
|
Category | ⇒ | JavaScript Search |
@smz
jquery.autocomplete.min.js is used for Search Suggestions and it's not always loaded because search suggestions can be disabled in finder component settings or in finder module settings.
Probably the better way is to add JHtml::_('jquery.framework');
line after condition:
if ($params->get('show_autosuggest', 1))
I checked, highlight works in this case fine.
Guys, I'm full of doubts: while it is true that also with my first commit things do works (even autocomplete and that also if highlighting is turned off), it also true that autocomplete needs jQuery, so conceptually we should explicitly load it also for it, even though there are at least "very good odds" that jQuery is loaded somewhere else.
So I think that everything boils down to this: do we want optimized code or safer code?
A possible alternative could be to put the following at the top:
if ($this->params->get('show_advanced', 1) || $this->params->get('show_autosuggest', 1))
{
JHtml::_('behavior.core');
JHtml::_('jquery.framework');
}
(@dgt41 core needed in both cases, right?)
Same about @dgt41's proposal of putting JHtml::_('jquery.framework');
inside behavior.php, before the highlighter thing: probably unneeded, but safer...
As @okonomiyaki3000 as shown in #5154, sometimes code optimization can have dramatic results...
@smz actually that suggestion for behavior.php is wrong, because the relative code is already there.
The logic needs some improvements, my initial approach here was: don’t break anything, remove mootools where possible. So yes both core and jquery can be selectively loaded only when needed. Just as a remark: the old behavior.framework
was always loading core.js, also the behavior.core
till very recently was loading jquery also, now it isn’t. Bottom line we have to go through all the views and explicitly call whatever is needed each time. Mootools is mostly out but still there might be room for further improvement (due to the changes in behavior.core
)
My 2c
yeap
Just a very simple site (Protostar), with "Smart Search" both as a menu item and a module... Skype+TeamViewer come and see?
Hold on everybody: further commits are probably coming...
Still hold on, please...
PR ready for testing: thanks!
@(re)test works for me, thanks!
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-12-17 16:30:27 |
See: #5438 for details.