? ? Success

User tests: Successful: Unsuccessful:

avatar alexva24
alexva24
8 Feb 2016

Added possibility to set script priority with $document->addScript(...);

To test use the code bellow:

$document = JFactory::getDocument();
$document->addScript('/script1.js', 'text/javascript', false, false, 1);
$document->addScript('/script2.js', 'text/javascript', false, false, 100);
print_r($document->_scripts);

$htmHeadRenderer = $document->loadRenderer('head');
echo $htmHeadRenderer->render('');
die;
``
avatar alexva24 alexva24 - open - 8 Feb 2016
avatar alexva24 alexva24 - change - 8 Feb 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 8 Feb 2016
Labels Added: ?
avatar Kubik-Rubik Kubik-Rubik - change - 8 Feb 2016
Labels Added: ?
avatar Kubik-Rubik Kubik-Rubik - change - 8 Feb 2016
Milestone Added:
avatar mahagr
mahagr - comment - 8 Feb 2016

:+1: for this one; I'm already emulating this in our component.

avatar brianteeman brianteeman - change - 8 Feb 2016
Category JavaScript
avatar ghazal
ghazal - comment - 8 Feb 2016

Great. Very nice feature.
Would it be possible to implement the same for addStyleSheet ?

avatar alexva24
alexva24 - comment - 9 Feb 2016

May be, but it will be out of this PR

avatar dgt41
dgt41 - comment - 2 Jun 2016

@PLT can you hold this one for J4? The reason is, that adding half baked functionality in 3.x for the assets will make harder the transition for a proper solution (dependency, priority, data attributes, etc). Obviously I am not against this, but I would prefer a solution that covers all aspects, even header-footer or any other position.

avatar wilsonge wilsonge - change - 8 Jun 2016
Milestone Removed:
avatar joomla-cms-bot joomla-cms-bot - change - 15 Aug 2016
Category JavaScript Libraries
avatar andrepereiradasilva
andrepereiradasilva - comment - 9 Oct 2016

@alexva24 @dgt41 IMHO, after #11289 merge, this could now be rewritten for the 3.7.x branch with the new JHtml::script(), JHtml::addScript, and JHtml::addScriptVersion method signatures

something like:

JFactory::getDocument()->addScript('/script1.js', array('priority' => 1));
JFactory::getDocument()->addScriptVersion('/script2.js', array('priority' => 1));
JHtml::('script', 'script3.js', array('priority' => 1));

Since the options array already exists in this methods, probably, all is needed is process the priority option in /libraries/joomla/document/renderer/html/head.php

avatar mbabker
mbabker - comment - 21 May 2017

This needs synchronizing with the current development branches to be reviewed.

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 May 2017
The description was changed
Status Pending Information Required
avatar joomla-cms-bot joomla-cms-bot - edited - 22 May 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 27 May 2017

If this PR get no Response, it will be closed at 22th June 2017.

avatar franz-wohlkoenig franz-wohlkoenig - change - 22 Jun 2017
Status Information Required Closed - No Reply
Closed_Date 0000-00-00 00:00:00 2017-06-22 03:57:17
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - close - 22 Jun 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 22 Jun 2017

closed as stated above.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/9083.

avatar joomla-cms-bot
joomla-cms-bot - comment - 22 Jun 2017

Add a Comment

Login with GitHub to post a comment