Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
9 Mar 2014

Issue

Currently, when we want to load core.js (kind of our own Joomla JavaScript "library") we use the same function as when we want to load the MooTools JavaScript library. That is JHtml::_('behavior.framework').
So far this wasn't a problem since core.js needed MooTools anyway.
Since now core.js is rewritten to jQuery, that JHtml method also has to load the jQuery framework.

Proposed Solution

This PR will introduce a new function JHtml::_('behavior.core') which is supposed to only load core.js. Since core.js depends on jQuery, it will also load jQuery. If we ever decide to rewrite core.js so it doesn't use jQuery anymore, this method could be changed easy to not loading jQuery anymore.

Testing Instructions

This only introduces the new method. To test, you need to manually change the call JHtml::_('behavior.framework') to JHtml::_('behavior.core') where possible and see that mootools is now longer loaded but core.js still is.
A good place to test would be the com_content category view with the table layout.
Change this line https://github.com/joomla/joomla-cms/blob/3.3-dev/components/com_content/views/category/tmpl/default_articles.php#L14 to JHtml::_('behavior.core')
.
Currently it will load mootools together with core.js.
If you comment the line out, neither will be loaded and the sorting function (clicking on table headers) will be broken.
Changing it to behavior.core will load core.js without mootools and the sorting will work (again).
When testing make sure you disable modules. They may load mootools as well (login for example does).

Future work

This will also be needed work for future PRs to change the current calls and remove the (hopefully
now) unneeded loading of Mootools.
My goal is to introduce this method now so it can be used as a base for future PRs.

Tracker

http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32994

Remark

This is basically the same as PR #3047, but now against 3.3 and taking into account that core.js is rewritten now.

avatar Bakual Bakual - open - 9 Mar 2014
avatar Bakual
Bakual - comment - 10 Mar 2014

Fixed UnitTests.

avatar Bakual
Bakual - comment - 12 Mar 2014

Updated initial comment with a test case (com_content, category view)

avatar bwmarkle
bwmarkle - comment - 16 Mar 2014

@test

#. I installed the latest 3.3 dev
#. I installed the patch
#. I went to Article Category LIst on the front end, and confirmed both mootools and core.js was loading
#. I edited components/com_content/views/category/tmpl/default_articles.php and changed behavior.framework to behavior.core
#. I refreshed the Article Category List page, and confirmed mootools was not loading, but core.js was
#. I tested the sorting features on the Article Category LIst page and it worked.
You may blame the J!Tracker Application for transmitting this comment.

avatar mbabker mbabker - change - 26 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-26 21:34:37
avatar mbabker mbabker - close - 26 Mar 2014
avatar mbabker mbabker - reference | d3d2c3c - 26 Mar 14
avatar mbabker mbabker - merge - 26 Mar 2014
avatar mbabker mbabker - close - 26 Mar 2014
avatar Bakual Bakual - head_ref_deleted - 27 Mar 2014
avatar Bakual Bakual - reference | be08a6f - 12 May 14

Add a Comment

Login with GitHub to post a comment