[ 
https://issues.apache.org/jira/browse/WW-4532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14654406#comment-14654406
 ] 

Hudson commented on WW-4532:
----------------------------

SUCCESS: Integrated in Struts-JDK7-master #346 (See 
[https://builds.apache.org/job/Struts-JDK7-master/346/])
WW-4532 Javascript generated by s:doubleselect has global variables that can 
interfer with the rest of the app (jogep: rev 
49c43b377e9f7de91dc474a6d191775126084343)
* core/src/main/resources/jshint.conf.js
* core/pom.xml
WW-4532 Javascript generated by s:doubleselect has global variables that can 
interfer with the rest of the app (jogep: rev 
0469947e67e42dccd6e459bd93e1565e52250895)
* core/src/main/resources/org/apache/struts2/static/inputtransferselect.js
* core/src/main/resources/org/apache/struts2/static/utils.js
* core/src/main/resources/template/css_xhtml/validation.js
* core/src/main/resources/org/apache/struts2/static/optiontransferselect.js
* core/src/main/resources/org/apache/struts2/interceptor/debugging/webconsole.js
WW-4532 Javascript generated by s:doubleselect has global variables that can 
interfer with the rest of the app (jogep: rev 
3e1087a7fa1b2ee32ce7b9fc8d8f289f2fd7d2fa)
* core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-1.txt
* core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-3.txt
* core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-2.txt
* core/src/main/resources/template/simple/debug.ftl
* core/src/main/resources/template/simple/doubleselect.ftl
* core/src/test/resources/org/apache/struts2/views/jsp/ui/DoubleSelect-4.txt


> Javascript generated by s:doubleselect has global variables that can interfer 
> with the rest of the app
> ------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4532
>                 URL: https://issues.apache.org/jira/browse/WW-4532
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.3.20
>            Reporter: Pierre Henry
>            Assignee: Johannes Geppert
>              Labels: javascript
>             Fix For: 2.5.x
>
>
> In the JavaScript code generated by the {{s:doubleselect}} tag (and, possibly 
> other tags), there are for loops using the following format :
> {code}
> for (m = ObservationForm_observation_countryKeyTemp.options.length - 1; m >= 
> 0; m--) {
>             ObservationForm_observation_countryKeyTemp.options[m] = null; 
> {code}
> The variable {{m}} is never defined before that. So this creates a globally 
> scoped {{m}} variable that can interfere with other JavaScript code.
> In my case it interfered with library code that is processed with a minifyer 
> (I think in this case it is Google Closure Compiler) and contains a lot of 
> one-letter variable name, such as... {{m}}.
> So I got the following error :
> {code}
> Uncaught TypeError: number is not a function
> {code}
> Which was difficult to trace since the code was minified. If the code was not 
> minified, then the error did not happen any more.
> I believe it would be enough to just use the var keyword in the loop 
> definition to remove this problem :
> {code}
> for (var m = ObservationForm_observation_countryKeyTemp.options.length - 1; m 
> >= 0; m--) {
>             ObservationForm_observation_countryKeyTemp.options[m] = null; 
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to