You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/04/12 13:30:15 UTC

[jira] [Comment Edited] (WICKET-5142) Generating invalid JavaScript for ajax update

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

Martin Grigorov edited comment on WICKET-5142 at 4/12/13 11:28 AM:
-------------------------------------------------------------------

I'm not quite sure.
Splitting will lead to bad performance, especially on IE.
The best is to chain the JS snippets and call Wicket's notify() (the callback passed by Wicket) at the end.
For example the perfect JS should look like:

(function(){notify|jQuery('#version4').fadeOut(400, function(){
   jQuery('#version4').fadeOut(400, notify);
})})();

But it will be hard to compose this at the client side.
                
      was (Author: mgrigorov):
    I'm not quite sure.
Splitting will lead to bad performance, especially on IE.
The best is to chain the JS snippets and call Wicket's notify() (the callback passed by Wicket) at the end.
For example the perfect JS should look like:

(function(){notify|jQuery('#version4').fadeOut(400, function(){
   jQuery('#version4').fadeOut(400, notify);
}));})();;

But it will be hard to compose this at the client side.
                  
> Generating invalid JavaScript for ajax update
> ---------------------------------------------
>
>                 Key: WICKET-5142
>                 URL: https://issues.apache.org/jira/browse/WICKET-5142
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>            Reporter: Alexey Mukas
>         Attachments: myproject.zip
>
>
> Suppose I have BlinkBehaviour 
> public static class BlinkBehaviour extends Behavior { 
>         @Override 
>         public void renderHead(Component component, IHeaderResponse response) { 
>             AjaxRequestTarget target = component.getRequestCycle().find(AjaxRequestTarget.class); 
>             if (target != null) { 
>                 target.prependJavaScript("notify|jQuery('#" + component.getMarkupId() + "').fadeOut(400, notify);"); 
>                 target.appendJavaScript("jQuery('#"+component.getMarkupId()+"').fadeIn(400);"); 
>             } 
>         } 
>     } 
> If I add it twice to a control and update the control via ajax 6.7.0-SNAPSHOT will yield error: 
> ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: SyntaxError: Unexpected token ), text: f = function(notify) {jQuery('#version2').fadeOut(400, notify);})();(function(){notify|jQuery('#version2').fadeOut(400, notify);};

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira