Pull Request #218: jQuery in Joomla core by jlleblanc · joomla/joomla-cms · GitHub

At J! and Beyond, we discussed ways of implementing jQuery in Joomla 3.0. Here is what we have so far:

A minified copy of jQuery 1.7.2

A file with jQuery.noConflict();

An additional method for JHtmlBehavior (would require Platfrom merge, unless we have a standard way of doing this in the CMS library)

Calling JHTML::_(‘behavior.jquery’); loads both jQuery and the separate file with noConflict. This is being done because Joomla currently loads all of the JavaScript files first, then loads all of the JavaScript declarations afterwards. If you load jQuery, then MooTools (or another file that pre-defines $), then call jQuery.noConflict(), it will not work: http://www.designvsdevelop.com/jquery-in-joomla-i-was-wrong/

This approach works, but it is sub-optimal as you have to incur the overhead of two HTTP requests. There are two workarounds we could pursue:

Manually add jQuery.noConflict(); at the end of jquery.min.js. We would have to do this every time we update jQuery. This is what WordPress does.

Add new code to JDocument and JDocumentRenderer that would allow declarations to be added immediately before or after a script is loaded. (I believe @beat mentioned he had a pull request for this on the platform)

Another thing we may want to consider is adding an option in Joomla that will let you specify a CDN copy of jQuery to use in place of the local one.

via Pull Request #218: jQuery in Joomla core by jlleblanc · joomla/joomla-cms · GitHub.


Joomla in GitHub

Joomla in GitHub

Here is the place where joomla is evolving. And see there, there is a branch name “3.0 alpha” . I am wondering what is inside that branch! 😀