[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-22 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17839491#comment-17839491
 ] 

ASF subversion and git services commented on WICKET-7104:
-

Commit 1c15e83c348d5001414a0aaa64da114ca1692007 in wicket's branch 
refs/heads/master from Martin Tzvetanov Grigorov
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=1c15e83c34 ]

WICKET-7104: Use JavaScript dynamic resolution of the first function parameter

Using the parameter name (i.e. 'input') does not work after JS
minification.
Using `arguments[0]` does not depend on the parameter name and should
work in both minified and non-minified JavaScript.

Signed-off-by: Martin Tzvetanov Grigorov 


> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-22 Thread ASF subversion and git services (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17839492#comment-17839492
 ] 

ASF subversion and git services commented on WICKET-7104:
-

Commit bd03775a3dc3678b63fce36ae8976311297a7114 in wicket's branch 
refs/heads/wicket-9.x from Martin Tzvetanov Grigorov
[ https://gitbox.apache.org/repos/asf?p=wicket.git;h=bd03775a3d ]

WICKET-7104: Use JavaScript dynamic resolution of the first function parameter

Using the parameter name (i.e. 'input') does not work after JS
minification.
Using `arguments[0]` does not depend on the parameter name and should
work in both minified and non-minified JavaScript.

Signed-off-by: Martin Tzvetanov Grigorov 
(cherry picked from commit 1c15e83c348d5001414a0aaa64da114ca1692007)


> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Martin Tzvetanov Grigorov (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837646#comment-17837646
 ] 

Martin Tzvetanov Grigorov commented on WICKET-7104:
---

Welcome to the web development (with JavaScript)!
IMO, using `arguments[0]` to refer to the first function parameter is a good 
solution. It should work no matter what is the actual parameter name (in 
minified and non-minified code).


> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Florian Wunderlich (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837619#comment-17837619
 ] 

Florian Wunderlich commented on WICKET-7104:


On one hand, please remember that this affects existing code and *only appears 
in production.* On the other, I'm pretty much the opposite of an expert in 
Javascript integration, but this whole approach seems quite fragile 
(referencing constructs in code that will be transformed later). Yes, as quick 
fix, this may work, but then minification decides to get rid of the function 
altogether at some point in the future and the result is again your 
applications breaking *in production from a minor release upgrade* (9.7.0 -> 
9.16.0) for some functionality that realistically nobody runs a test for.

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Martin Tzvetanov Grigorov (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837608#comment-17837608
 ] 

Martin Tzvetanov Grigorov commented on WICKET-7104:
---

How about using `arguments[0]` instead of `input` ?

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Florian Wunderlich (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837593#comment-17837593
 ] 

Florian Wunderlich commented on WICKET-7104:


Hello [~mgrigorov], the approach to fix this depends on your policy.

Do you want to keep minification like it is at the moment? Then there must be 
some mechanism to exclude specific constructs (like this function parameter) 
from renaming, or the whole functionality to return a Javascript fragment from 
this method (and potentially others) that reference such constructs must be 
adapted (e.g. return a whole function).

Otherwise, minification can be rolled back to what it was in 9.7.0.

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Florian Wunderlich (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837586#comment-17837586
 ] 

Florian Wunderlich commented on WICKET-7104:


See the red emphasis in the Javadoc in the description I posted. According to 
that, for {{{}AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression{}}}, 
you are supposed to return "input" as last part of the expression. This refers 
to the "input" parameter that, as you noticed, does not exist anymore.

Suppose {{AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression}} 
returns some Javascript with the last part being "input", as specified by the 
documentation. Just take the example from this documentation that I've posted.

Non-minified (development): this last part "input" is resolved as the parameter 
name of the Javascript function handleSelection in wicket-autocomplete.js.

Minified (production): this last part "input" cannot be resolved anymore, as 
the Javascript function handleSelection in wicket-autocomplete.min.js does not 
have a parameter "input" - it is named "d" after minification.

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Maxim Solodovnik (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837577#comment-17837577
 ] 

Maxim Solodovnik commented on WICKET-7104:
--

Hello [~fwunderlich]

Actually these 3 functions looks identical to me:
{code}
function handleSelection(input) {
  var attr = getSelectableElement(selected).attributes.onselect;
  return attr ? eval(attr.value) : input;
}

function handleSelection(input){var 
attr=getSelectableElement(selected).attributes.onselect;return 
attr?eval(attr.value):input}

function O(d){var a=J(p).attributes.onselect;return a?eval(a.value):d}
{code}

last one uses {{d}} instead of {{input}} I can see nothing wrong here 

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively

2024-04-16 Thread Martin Tzvetanov Grigorov (Jira)


[ 
https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17837550#comment-17837550
 ] 

Martin Tzvetanov Grigorov commented on WICKET-7104:
---

Thanks for the report!
It is not very clear what exactly is the problem to me...
Do you want to send a Pull Request / patch with a fix ?

> wicket-autocomplete.min.js minified too aggressively
> 
>
> Key: WICKET-7104
> URL: https://issues.apache.org/jira/browse/WICKET-7104
> Project: Wicket
>  Issue Type: Bug
>  Components: wicket-extensions
>Affects Versions: 9.16.0, 10.0.0, 9.17.0
>Reporter: Florian Wunderlich
>Priority: Major
>
> Since at least Wicket 9.16.0, the minified wicket-autocomplete.min.js is 
> broken.
> {{Javadoc AbstractAutoCompleteRenderer#getOnSelectJavaScriptExpression:}}
> {{[...]}}
> {{     * the current text value will be in variable 'input'.}}
> {{     * }}
> {{     * If the function returns null the chosen text value will 
> be ignored.}}
> {{     * }}
> {{     * example 1:}}
> {{     * }}
> {{     * }}
> {{     * protected CharSequence getOnSelectJavaScript(Address address)}}
> {{     * {}}
> {{     *     final StringBuilder js = new StringBuilder();}}
> {{     *     js.append("wicketGet('street').value ='" + address.getStreet() + 
> "';");}}
> {{     *     js.append("wicketGet('zipcode').value ='" + address.getZipCode() 
> + "';");}}
> {{     *     js.append("wicketGet('city').value ='" + address.getCity() + 
> "';");}}
> {{     *     js.append("{color:#ff}*input*{color}"); // <-- do not use 
> return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * }}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff}*input*{color}){var 
> attr=getSelectableElement(selected).attributes.onselect;return 
> attr?eval(attr.value):{color:#ff}{*}input{*}{color:#172b4d}}{color}
> {color:#172b4d}Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 
> 10.0.0:{color}
> {color:#172b4d}function O({color}{*}d{*}{color})\{var 
> a=J(p).attributes.onselect;return a?eval(a.value):d}
> There is no "input" parameter anymore. Minification is too aggressive and 
> breaks this functionality, which {*}only happens in production{*}, since in 
> development the non-minimized source JS files will be used.
> Workaround: set 
> Application.get().getResourceSettings().getUseMinifiedResources() to false 
> when deploying into production.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)