? Success

User tests: Successful: Unsuccessful:

avatar piotrmocko
piotrmocko
8 Feb 2014

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._

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

avatar piotrmocko piotrmocko - open - 8 Feb 2014
avatar Fedik
Fedik - comment - 9 Feb 2014

If you do use core.js for JText::script always, then I would suggest make there nicer: html/renderer/head.php#L220-L234

avatar piotrmocko
piotrmocko - comment - 9 Feb 2014

I have just changed as you have proposed. That is better solution.

avatar Fedik
Fedik - comment - 9 Feb 2014

you understood me wrong :wink:
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 :smile:
This code is allow Joomla.JText works when core.js not loaded, but it have no sense if core.js will be available :wink:

avatar Bakual
Bakual - comment - 9 Feb 2014

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

avatar piotrmocko
piotrmocko - comment - 13 Feb 2014

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

avatar piotrmocko
piotrmocko - comment - 13 Feb 2014

I have just updated with all yours suggestions.

avatar mbabker mbabker - close - 9 Mar 2014
avatar mbabker
mbabker - comment - 9 Mar 2014

Merged to 3.3-dev

avatar mbabker mbabker - change - 9 Mar 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-03-09 05:04:53
avatar mbabker mbabker - close - 9 Mar 2014
avatar dbhurley dbhurley - reopen - 26 Jul 2014
avatar dbhurley
dbhurley - comment - 26 Jul 2014

@wilsonge mentions this is not present in staging or 3.4-dev. Re-opening to ensure it's merged.

avatar dbhurley dbhurley - change - 26 Jul 2014
Status Closed New
avatar dbhurley dbhurley - reopen - 26 Jul 2014
avatar Bakual
Bakual - comment - 27 Jul 2014

@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.

avatar piotrmocko piotrmocko - change - 29 Jul 2014
Title
JText::script is not loading Joomla core.js
[#33067] JText::script is not loading Joomla core.js
avatar piotrmocko
piotrmocko - comment - 29 Jul 2014

I have just updated code to use new core dependence

avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 2 Sep 2014
Category JavaScript
avatar brianteeman brianteeman - change - 17 Oct 2014
Title
[#33067] JText::script is not loading Joomla core.js
JText::script is not loading Joomla core.js
avatar wilsonge wilsonge - close - 23 Dec 2014
avatar wilsonge wilsonge - change - 23 Dec 2014
Status Pending Closed
Closed_Date 2014-03-09 05:04:53 2014-12-23 00:41:45
avatar wilsonge wilsonge - change - 23 Dec 2014
Title
JText::script is not loading Joomla core.js
[#33067] JText::script is not loading Joomla core.js
avatar wilsonge
wilsonge - comment - 23 Dec 2014

Merged this into staging again :) Thanks again!

Add a Comment

Login with GitHub to post a comment