[ 
https://issues.apache.org/jira/browse/WW-5835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-5835:
------------------------------
    Fix Version/s: 7.5.0

> Emit each static script src once per request in the script component
> --------------------------------------------------------------------
>
>                 Key: WW-5835
>                 URL: https://issues.apache.org/jira/browse/WW-5835
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Tags
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>
> Tag templates that need a framework script include it per instance with 
> {{<@s.script src="..."/>}}. A page that renders the same tag N times, for 
> example inside an iterator, therefore emits N identical {{<script 
> src="...">}} tags.
> Templates that include a static script per instance today:
> * {{simple/inputtransferselect.ftl}}
> * {{simple/optiontransferselect.ftl}}
> * {{simple/updownselect.ftl}}
> * {{simple/combobox.ftl}} and {{html5/combobox.ftl}} after 
> [WW-5774|https://issues.apache.org/jira/browse/WW-5774]
> The scripts guard themselves with a window-level flag, so the duplicates do 
> not re-bind listeners. They are still redundant markup, and each one is 
> fetched or cache-checked by the browser.
> Proposal: let the {{Script}} component remember which {{src}} values it has 
> already written during the current request, for example in a request 
> attribute, and render nothing for a repeated {{src}}. This removes the 
> duplication for every static script at once, instead of handling it in each 
> template.
> Raised during the review of [PR 
> #2074|https://github.com/apache/struts/pull/2074].



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to