?
avatar KianWilliam
KianWilliam
25 Jul 2018

Is your feature request related to a problem? To set an attribute using addScript or addScriptDeclaration of $document methods when adding a script tag.

Describe the solution you'd like

$document->addScript(file.js, 'text/x-template', 'modal-template')
result could be forexample:

<script type="text/x-template" id="modal-template"></script>

Additional context

avatar KianWilliam KianWilliam - open - 25 Jul 2018
avatar joomla-cms-bot joomla-cms-bot - change - 25 Jul 2018
Title
To set attributes for <script> tag using addScript or addScriptDeclaration
To set attributes for tag using addScript or addScriptDeclaration
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 25 Jul 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jul 2018
Category com_tags JavaScript
avatar joomla-cms-bot joomla-cms-bot - edited - 25 Jul 2018
avatar dgrammatiko
dgrammatiko - comment - 25 Jul 2018

Please ALWAYS use the JHtml! It's the prefered API for the static assets and already supports what you need here

avatar mbabker
mbabker - comment - 25 Jul 2018

Use the $attribs param of HTMLHelper::script() or Document::addScript() to add attributes such as these. This feature is not supported on addScriptDeclaration and a pull request adding it would be welcome.

avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jul 2018
Status New Discussion
avatar KianWilliam
KianWilliam - comment - 25 Jul 2018

Document::addScript( ) does not have the $attribs param, it has $url, $type
, $defer and $async
Kian William

On Wed, Jul 25, 2018 at 4:40 PM, Michael Babker notifications@github.com
wrote:

Use the $attribs param of HTMLHelper::script() or Document::addScript()
to add attributes such as these. This feature is not supported on
addScriptDeclaration and a pull request adding it would be welcome.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21253 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AO1hTAtVS8NWrxiu43iyZMxIWOufaxKOks5uKGBJgaJpZM4VfxEU
.

avatar mbabker
mbabker - comment - 25 Jul 2018

Then you are on a massively outdated release as the signature was changed at 3.7.0 to have the $attribs param.

avatar KianWilliam
KianWilliam - comment - 26 Jul 2018

Actually before sending this request I mentioned it in Joomla Forum :
https://forum.joomla.org/viewtopic.php?f=706&t=963885
to be sure. Thanks for the information
Kian William

On Wed, Jul 25, 2018 at 11:15 PM, Michael Babker notifications@github.com
wrote:

Then you are on a massively outdated release as the signature was changed
at 3.7.0 to have the $attribs param.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#21253 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AO1hTJ2nxaXrtn56JEDFWYvMnwq5Raztks5uKLzMgaJpZM4VfxEU
.also addScriptDeclaration does not have $attribs yet, does it?

avatar Quy
Quy - comment - 26 Jul 2018

@KianWilliam Please close this issue if solved. Thanks.

avatar KianWilliam
KianWilliam - comment - 26 Jul 2018

Also addScriptDeclaration does not have $attribs param, does it?
Kian William

avatar KianWilliam KianWilliam - change - 26 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-26 03:45:03
Closed_By KianWilliam
avatar KianWilliam KianWilliam - close - 26 Jul 2018

Add a Comment

Login with GitHub to post a comment