User tests: Successful: Unsuccessful:
JText::script should always load system JavaScript file: core.js which has declaration of function: Joomla.JText._ which should be used in JavaScript files for translating strings. If Mootools is not loaded or some other resource which is loading core.js then you will get an error trying to use: Joomla.JText._
I have just changed as you have proposed. That is better solution.
you understood me wrong JHtml::_('script', 'system/core.js', false, true);
can be where you did it first,
It will not work as you did now, because all scripts already rendered.
I mean other,
I mean that part of the code that on html/renderer/head.php#L220-L234 is unneeded after applying this pull request. So would be good clean up there
This code is allow Joomla.JText
works when core.js
not loaded, but it have no sense if core.js
will be available
Currently, core.js has a dependancy on mootools. So you should never load core.js without mootools. Thus currently the way to load it is JHtml::_('behavior.framework');
.
We will need a new way to load core.js as soon as it's rewritten for jQuery (or to use no dependancy at all). My suggestion would be to use a new function JHtml::_('behavior.core')
by then. I made a PR a while ago to prepare for that: #3047.
I'm not a huge fan of loading it with JHtml::_('script', 'system/core.js', false, true);
as this would still load mootools after it is converted to jQuery with #2687
Now I have made it incorrect. I am loading core.js to late. We can remove this part of code
https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/html/renderer/head.php#L225-L229 and L231. Rest has to stay to load language strings.
I will have a look at core.js and maybe I will rewrite it to jQuery if there isn't already some PR
I have just updated with all yours suggestions.
Merged to 3.3-dev
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-03-09 05:04:53 |
Status | Closed | ⇒ | New |
@piotrmocko Can you update the PR to use the new JHtml::_('behavior.core');
since it's available and rewritten to use jQuery since Joomla 3.3.
Title |
|
I have just updated code to use new core dependence
Status | New | ⇒ | Pending |
Labels |
Removed:
?
|
Category | ⇒ | JavaScript |
Title |
|
Status | Pending | ⇒ | Closed |
Closed_Date | 2014-03-09 05:04:53 | ⇒ | 2014-12-23 00:41:45 |
Title |
|
Merged this into staging again :) Thanks again!
If you do use
core.js
forJText::script
always, then I would suggest make there nicer: html/renderer/head.php#L220-L234