Re: [PR] WICKET-7103 [wicket]
martin-g merged PR #833: URL: https://github.com/apache/wicket/pull/833 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
(wicket) branch master updated: WICKET-7103 (#833)
This is an automated email from the ASF dual-hosted git repository. mgrigorov pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/wicket.git The following commit(s) were added to refs/heads/master by this push: new 550858b77c WICKET-7103 (#833) 550858b77c is described below commit 550858b77c2209529517a07fe4b6f61372871e29 Author: Johannes Renoth AuthorDate: Tue Apr 16 09:27:24 2024 +0200 WICKET-7103 (#833) * WICKET-7103 Make it possible to post process the Ajax attributes for ModalDialog - Co-authored-by: renoth --- .../ajax/markup/html/modal/ModalDialog.java| 63 +- .../ajax/markup/html/modal/ModalDialogTest.java| 60 + 2 files changed, 97 insertions(+), 26 deletions(-) diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java index 3b99248df2..22ac209a2c 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/ModalDialog.java @@ -41,7 +41,7 @@ import org.apache.wicket.markup.html.panel.Panel; * modal-dialog-content * any additional styling for the content of this dialog * - * + * * @author Igor Vaynberg (ivaynberg) * @author svenmeier */ @@ -56,7 +56,7 @@ public class ModalDialog extends Panel /** * The id for the content of this dialoh. -* +* * @see #setContent(Component) * @see #open(Component, AjaxRequestTarget) */ @@ -84,9 +84,9 @@ public class ModalDialog extends Panel /** * Factory method for the overlay markup around the dialog. -* +* * @param overlayId -*id +* id * @return overlay */ protected WebMarkupContainer newOverlay(String overlayId) @@ -96,9 +96,9 @@ public class ModalDialog extends Panel /** * Factory method for the dialog markup around the content. -* +* * @param dialogId -*id +* id * @return overlay */ protected WebMarkupContainer newDialog(String dialogId) @@ -108,9 +108,8 @@ public class ModalDialog extends Panel /** * Set a content. -* +* * @param content -* * @see #open(AjaxRequestTarget) */ public void setContent(Component content) @@ -130,13 +129,12 @@ public class ModalDialog extends Panel * Open the dialog with a content. * * The content will be removed on close of the dialog. -* +* * @param content -*the content +* the content * @param target -*an optional Ajax target +* an optional Ajax target * @return this -* * @see #setContent(Component) * @see #close(AjaxRequestTarget) */ @@ -157,18 +155,18 @@ public class ModalDialog extends Panel /** * Open the dialog. -* +* * @param target -*an optional Ajax target +* an optional Ajax target * @return this -* * @see #setContent(Component) */ public ModalDialog open(AjaxRequestTarget target) { if (overlay.size() == 0) { - throw new WicketRuntimeException(String.format("ModalDialog with id '%s' has no content set!", getId())); + throw new WicketRuntimeException( + String.format("ModalDialog with id '%s' has no content set!", getId())); } overlay.setVisible(true); @@ -183,7 +181,7 @@ public class ModalDialog extends Panel /** * Is this dialog open. -* +* * @return true if open */ public boolean isOpen() @@ -196,11 +194,10 @@ public class ModalDialog extends Panel * * If opened via {@link #open(Component, AjaxRequestTarget)}, the content is removed from the * component tree -* +* * @param target -*an optional Ajax target +* an optional Ajax target * @return this -* * @see #open(Component, AjaxRequestTarget) */ public ModalDialog close(AjaxRequestTarget target) @@ -221,7 +218,7 @@ public class ModalDialog extends Panel /** * Close this dialog on press of escape key. -* +* * @return this */ public ModalDialog closeOnEscape() @@ -238,7 +235,7 @@ public cla
Re: [PR] WICKET-7103 [wicket]
martin-g commented on PR #833: URL: https://github.com/apache/wicket/pull/833#issuecomment-2058416854 Thank you, @renoth ! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (WICKET-7103) Enhance ModalDialog API
[ https://issues.apache.org/jira/browse/WICKET-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837546#comment-17837546 ] ASF GitHub Bot commented on WICKET-7103: martin-g commented on PR #833: URL: https://github.com/apache/wicket/pull/833#issuecomment-2058416854 Thank you, @renoth ! > Enhance ModalDialog API > --- > > Key: WICKET-7103 > URL: https://issues.apache.org/jira/browse/WICKET-7103 > Project: Wicket > Issue Type: Improvement > Components: ModalDialog >Reporter: Johannes Renoth >Priority: Major > > At the moment it is impossible to change the AjaxRequestAttributes of the > CloseBehavior in ModalDialog. Sometimes it is warranted to change the Ajax > Channel or the Queue Type. For this reason an API should be provided. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Resolved] (WICKET-7103) Enhance ModalDialog API
[ https://issues.apache.org/jira/browse/WICKET-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Martin Tzvetanov Grigorov resolved WICKET-7103. --- Fix Version/s: 10.1.0 Assignee: Johannes Renoth Resolution: Fixed > Enhance ModalDialog API > --- > > Key: WICKET-7103 > URL: https://issues.apache.org/jira/browse/WICKET-7103 > Project: Wicket > Issue Type: Improvement > Components: ModalDialog >Reporter: Johannes Renoth >Assignee: Johannes Renoth >Priority: Major > Fix For: 10.1.0 > > > At the moment it is impossible to change the AjaxRequestAttributes of the > CloseBehavior in ModalDialog. Sometimes it is warranted to change the Ajax > Channel or the Queue Type. For this reason an API should be provided. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (WICKET-7103) Enhance ModalDialog API
[ https://issues.apache.org/jira/browse/WICKET-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837544#comment-17837544 ] ASF GitHub Bot commented on WICKET-7103: martin-g merged PR #833: URL: https://github.com/apache/wicket/pull/833 > Enhance ModalDialog API > --- > > Key: WICKET-7103 > URL: https://issues.apache.org/jira/browse/WICKET-7103 > Project: Wicket > Issue Type: Improvement > Components: ModalDialog >Reporter: Johannes Renoth >Priority: Major > > At the moment it is impossible to change the AjaxRequestAttributes of the > CloseBehavior in ModalDialog. Sometimes it is warranted to change the Ajax > Channel or the Queue Type. For this reason an API should be provided. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (WICKET-7103) Enhance ModalDialog API
[ https://issues.apache.org/jira/browse/WICKET-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837545#comment-17837545 ] ASF subversion and git services commented on WICKET-7103: - Commit 550858b77c2209529517a07fe4b6f61372871e29 in wicket's branch refs/heads/master from Johannes Renoth [ https://gitbox.apache.org/repos/asf?p=wicket.git;h=550858b77c ] WICKET-7103 (#833) * WICKET-7103 Make it possible to post process the Ajax attributes for ModalDialog - Co-authored-by: renoth > Enhance ModalDialog API > --- > > Key: WICKET-7103 > URL: https://issues.apache.org/jira/browse/WICKET-7103 > Project: Wicket > Issue Type: Improvement > Components: ModalDialog >Reporter: Johannes Renoth >Priority: Major > > At the moment it is impossible to change the AjaxRequestAttributes of the > CloseBehavior in ModalDialog. Sometimes it is warranted to change the Ajax > Channel or the Queue Type. For this reason an API should be provided. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)
[jira] [Commented] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Comment Edited] (WICKET-7104) wicket-autocomplete.min.js minified too aggressively
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17837608#comment-17837608 ] Martin Tzvetanov Grigorov edited comment on WICKET-7104 at 4/16/24 8:49 AM: How about using `arguments[0]` instead of `input` in the Javascript function body ? was (Author: mgrigorov): 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
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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
[ https://issues.apache.org/jira/browse/WICKET-7104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)