You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Florian Wunderlich (Jira)" <ji...@apache.org> on 2024/04/14 20:09:00 UTC

[jira] [Updated] (WICKET-7104) wicket-autocomplete.min.js minified too aggresively

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

Florian Wunderlich updated WICKET-7104:
---------------------------------------
    Description: 
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 <code>null</code> the chosen text value will be ignored.}}
{{     * <p/>}}
{{     * example 1:}}
{{     * }}
{{     * <pre>}}
{{     * 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:#ff0000}*input*{color}"); // <-- do not use return statement here!}}
{{     *     return js.toString();}}
{\{     * }}}
{{     * </pre>}}
{{[...]}}

wicket-autocomplete.js source:
function handleSelection({color:#ff0000}*input*{color}) {
  var attr = getSelectableElement(selected).attributes.onselect;
  return attr ? eval(attr.value) : {color:#ff0000}*input*{color};
}

Minified wicket-autocomplete.min.js, 9.7.0:
function handleSelection({color:#ff0000}*input*{color}){var attr=getSelectableElement(selected).attributes.onselect;return attr?eval(attr.value):{color:#ff0000}{*}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.

  was:
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 <code>null</code> the chosen text value will be ignored.}}
{{     * <p/>}}
{{     * example 1:}}
{{     * }}
{{     * <pre>}}
{{     * protected CharSequence getOnSelectJavaScript(Address address)}}
{{     * {}}
{{     *     final StringBuilder js = new StringBuilder();}}
{{     *     js.append(&quot;wicketGet('street').value ='&quot; + address.getStreet() + &quot;';&quot;);}}
{{     *     js.append(&quot;wicketGet('zipcode').value ='&quot; + address.getZipCode() + &quot;';&quot;);}}
{{     *     js.append(&quot;wicketGet('city').value ='&quot; + address.getCity() + &quot;';&quot;);}}
{{     *     js.append(&quot;{color:#FF0000}*input*{color}&quot;); // &lt;-- do not use return statement here!}}
{{     *     return js.toString();}}
{{     * }}}
{{     * </pre>}}
{{[...]}}

wicket-autocomplete.js source:
function handleSelection({color:#FF0000}*input*{color}) {
  var attr = getSelectableElement(selected).attributes.onselect;
  return attr ? eval(attr.value) : {color:#FF0000}*input*{color};
}

Minified wicket-autocomplete.min.js, 9.7.0:
function handleSelection({color:#FF0000}*input*{color}){var attr=getSelectableElement(selected).attributes.onselect;return attr?eval(attr.value):{color:#FF0000}*input*{color}}

Minified wicket-autocomplete.min.js, 9.16.0, 9.17.0 and 10.0.0:
function O({*}{color:#FF0000}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.


> wicket-autocomplete.min.js minified too aggresively
> ---------------------------------------------------
>
>                 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 <code>null</code> the chosen text value will be ignored.}}
> {{     * <p/>}}
> {{     * example 1:}}
> {{     * }}
> {{     * <pre>}}
> {{     * 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:#ff0000}*input*{color}"); // <-- do not use return statement here!}}
> {{     *     return js.toString();}}
> {\{     * }}}
> {{     * </pre>}}
> {{[...]}}
> wicket-autocomplete.js source:
> function handleSelection({color:#ff0000}*input*{color}) {
>   var attr = getSelectableElement(selected).attributes.onselect;
>   return attr ? eval(attr.value) : {color:#ff0000}*input*{color};
> }
> Minified wicket-autocomplete.min.js, 9.7.0:
> function handleSelection({color:#ff0000}*input*{color}){var attr=getSelectableElement(selected).attributes.onselect;return attr?eval(attr.value):{color:#ff0000}{*}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)