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 12:26:15 UTC

[jira] [Commented] (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=13629974#comment-13629974 ] 

Martin Grigorov commented on WICKET-5142:
-----------------------------------------

This is more trickier than it seems.
The problem at the moment is the Regex that we use to detect that a manual execution of 'notify' is needed. But the deeper problem is that the user code has two executions of 'notify', i.e. the first execution will release FunctionsExecutor to proceed with the following steps.

The solution that I see is to split the combined JavaScript into parts again. For example:

combined: (function(){notify|jQuery('#version4').fadeOut(400, notify);})();(function(){notify|jQuery('#version4').fadeOut(400, notify);})();
to:
1) (function(){notify|jQuery('#version4').fadeOut(400, notify);})();
2) (function(){notify|jQuery('#version4').fadeOut(400, notify);})();

and then execute them one by one, so they wait for each other.
                
> 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