New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create JHtml::_('behavior.core') to decouble core.js from mootools framework #2696
Conversation
Second parameter in [script] function should be now [false] for [tabstate] function. This is because this tabs-state.js requires JQuery not full Mootools framework. Setting this to [true] not only load Mootools when it is not required but also cause some conflicts if websites that depends on JQuery without noConflict.
Nice and needed decoupling. However, if JHtml::_('behavior.core') is not loaded systematically in Joomla's admin area, or at least in the tabs of admin area in next 3.2.x, it will not fix the side-effect-incompatibility introduced by 0247d9f in 3.2.1. |
I don't think we need to load this on each page in backend. It's the same as for jQuery, load it if needed. Don't load it if you don't need it. |
List of all functions currently in
|
I would be happy keep core.js without any library dependency, and load it over all scripts, when if I right remember there only |
I wouldn't load it always. Especially in frontend most of the time it is not needed at all. |
Yes, please don't. |
I did not say "always", |
Yes, but the result will be that it's loaded always as most sites have at least one script loaded on a page. |
ideas come from #1260 and #1319 but main idea of my first comment here was: would be good to have the core.js without library dependency |
Currently, It's exactly the purpose of this PR to decouple the loading from core.js from MooTools. |
I can try change the script in core.js for remove library dependency, if we will agree on that point :) |
@Fedik There is already a PR to change it to jQuery (linked above). I'd suggest contacting Ashan Fernando if it can be improved. |
New one against staging: #3047 |
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 isJHtml::_('behavior.framework')
.So far this wasn't a problem since core.js needed MooTools anyway.
Since we want to remove MooTools and there are quite a few PRs around which deals with that and also rewrites core.js to jQuery, we may end up loading MooTools only to get core.js. This is of course not good.
Proposed Solution
This PR will introduce a new function
JHtml::_('behavior.core')
which is supposed to only load core.js.Currently, this would still load MooTools since core.js depends on it. It's implemented as a simple proxy to behavior.framework for now.
As soon as core.js is rewritten to jQuery, the function can be changed to load jquery.framework and core.js instead.
I already wrote the code for that with comments what needs to be done.
Goal
Introducing this new class already "ahead of time" would allow us to start rewriting our extensions to use this new class, so when core.js is changed, we don't need to change anything anymore.
After all core javascript functions are rewritten to jQuery, we can then deprecate behavior.framework and remove it with J4.0.
This also gives 3rd party developers a bit more time to do the transition.
Tracker
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32994