User tests: Successful: Unsuccessful:
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;
``
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Labels |
Added:
?
|
Milestone |
Added: |
Category | ⇒ | JavaScript |
Great. Very nice feature.
Would it be possible to implement the same for addStyleSheet ?
May be, but it will be out of this PR
@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.
Milestone |
Removed: |
Category | JavaScript | ⇒ | Libraries |
@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
This needs synchronizing with the current development branches to be reviewed.
Status | Pending | ⇒ | Information Required |
If this PR get no Response, it will be closed at 22th June 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 |
closed as stated above.
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/9083
for this one; I'm already emulating this in our component.