Remove redundant calls for mootools#4475
Remove redundant calls for mootools#4475dgrammatiko wants to merge 30 commits intojoomla:stagingfrom dgrammatiko:mootools
Conversation
|
Tests are failing as the required framework is absent, some help here will be nice ;) |
Modal still needs Mootools Wrong calls to static::core();
|
https://github.com/dgt41/joomla-cms/pull/6 help is at hand :) |
|
@wilsonge Thanks for the unit tests code 💯 About tooltips: Yes something funny happening there I think is got to do with this code Which I think is useless, just a class and a JText::_(’TOOLTIP_TEXT’); is all needed. I am investigating the (spaghetti code) and hopefully I’ll come up with some changes… The thing is that you can call tooltips in 2 ways: And The last one needs mootools (legacy staff), but is not used in admin or front end any more... |
Fix tests
|
Travis fails here JHtmlBehaviorTest::testTooltip and here JHtmlBehaviorTest::testNoFrames |
Executive summary:First of all don’t be afraid of the number of files this PR touches.
So although many changes applied the functionality remains the same, but this will ease our way to drop mootools down the road… |
There was a problem hiding this comment.
phpstorm is acting weirdly lately, I think needs money for the next version :)
There was a problem hiding this comment.
maybe better change the order, to be logical?
(the core first, and all else go after)
There was a problem hiding this comment.
Makes sense, thanks @Fedik. By the way if you have some spare time can you look at the script in administrator/components/com_menus/views/item/tmpl/edit.php. mootools is needed here @ // special case for modal popups validation response. Can we use vanilla js and replace that logic? My js skills are not up to that task :(
|
@DGT41 you mean this #L56-L86 ? and maybe better make this in separate pull, cause there need not a trivial changes |
|
At least mootools is properly called here https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_menus/views/item/tmpl/edit.php#L15 so no rush to drop that, yet! |
|
Update as more tests was conducted: which obviously has to become jquery (or vanilla) |
|
On Global Configuration is mootools-more and mootools-core still loaded |
|
Yes, which is correct because there is a modal window there, and modal is a mootools script. Unless somebody comes up with new code for modal.js there is nothing more that we can do about it. PS the modal in @: Offline Image on the select button |
|
do you know the code to show mootools-core. Because its also loaded on sysinfo, I can't find the mootools loading |
|
You can comment this line https://github.com/dgt41/joomla-cms/commit/4ce723d74cb6caf0b200c28d888e5d5a1394f47e#diff-22d356c612b1a6ccbefdcdd05cd81a88R12 |
|
In most pages motools load because of the toolbar buttons removing that will break B/C |
|
@810 I just pushed some corrections that are more appropriate for toolbar, please try... |
|
@DGT41 looks good for me, but is it b/c proof? |
|
No, we don’t want to totally remove mootools. Basically this is a clean up and preparing the code for jquery. But even if I provide all the code that is needed for core components, mootools unfortunately cannot go away because almost all code from 3PD is still using it. This is not a way to TOTALLY REMOVE mootools as this cannot be done in 3.x. But will ease the way for 4.x. And yes it should be 100% safe. |
|
@DGT41 good points and well done. Indeed it will be good to completely move all core code to jQuery. Mootools can stay in the package and be used by 3rd parties as they see fit. At least it will be ready for removal when Joomla 4 comes around. |
|
@Fedik Nice! 😃 Patch tester clash those 2 PRs so I have to copy paste your code. Will do it later. Thanks |
|
Closing this one, as I break it to two separate and easier to review PRs. |
As most of the javascripts are now based on jQuery some calls to load mootools framework are redundant.
This is a response to #4473
This PR removes it from
The only case I left the moo tools framework is for tree.
B/C
Shouldn’t break something, as the scripts are NOT moo tools dependent.
Test
Try different navigation on a site (admin will be easier) and check that form validate, compobox, tooltip, modal and noframes still function as usual. Please check 3PD code with this, let’s NOT break things here!!!
EDIT
Except libraries/joomla/cms/html/behavior.php
I found out that toolbar is always loading mootools, for no particular reason so removed it from the files confirm, standard, help in libraries/joomla/cms/toolbar/button
Also almost all backend views have a basic check for the form where the code expects mootools
This can be done also with vanilla
document.getElementById('banner-form’)So most of the changes are document.id -> document.getElementById
Thanks @Fedik for the heads up!!!