[
https://issues.apache.org/jira/browse/WICKET-6902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17382600#comment-17382600
]
Sven Meier commented on WICKET-6902:
------------------------------------
Yes [~tobiashaupt] you're right. Apparently the documentation was out of sync
of the actual implementation.
I don't see a reason why we should limit the possibilities to append or prepend
JavaScript, as I have done inadvertently in Wicket 9.x.
Thus I reverted the offending code location on branch
WICKET-6902-js-after-components, including fixes to the documentation. I've
deprecated AjaxRequestTarget.IJavaScriptResponse, since we can just pass the
AjaxRequestTarget to AjaxRequestTarget.IListener.onAfterRespond instead, since
both appendJavaScript() and prependJavaScript() can be used (as you did it)..
> Change of PartialPageUpdate order of onAfterResponse and
> writePriorityEvaluations makes IListener.onAfterResponde ignore prepended
> javascripts
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: WICKET-6902
> URL: https://issues.apache.org/jira/browse/WICKET-6902
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 9.3.0
> Reporter: Tobias Haupt
> Assignee: Sven Meier
> Priority: Major
> Attachments: prependjs-quickstart.zip
>
>
> In wicket 8 it was possible to call AjaxRequestTarget.prependJavaScript from
> within IListener.onAfterRespond.
> A change in:
> https://github.com/apache/wicket/commit/b7f62a6591ea3e98374079555c877ba70ba30286#diff-d78837c7a0946ee5118aea1054d96c774a7d381d16dc5374ea87e7f018c6be94
> was made, that switched the order of writePriorityEvaluations and
> onAfterRespond calls.
> The javadoc of IListener.onAfterRespond states:
> "NOTE: During this stage of processing any calls to target that manipulate
> the response (adding components, javascript) will have no effect"
> This statement is problematic, because it has not been correct in wicket 8.
> There it was possible to prepend and append javascripts to the current
> AjaxRequestTarget at that stage. Now it is no longer possible to prepend
> javascripts, but still possible to append them.
> In AjaxRequestHandler (line 148) there is a comment: "create response that
> will be used by listeners to append javascript". This implies, that it should
> be possible to add javascripts somehow.
> Clarification needed:
> - Why has the order been changed in the first place? Was it related to a fix
> in WICKET-6703?
> - Is the javadoc correct? When why can javascripts still be appended?
> - Can the PartialPageUpdate use Freezing to throw Exceptions whenever things
> are added too late and are already written? Like in
> AjaxRequestHandler.listenersFrozen. The current behavior (simply ignoring
> scripts) is error prone and made our application fail silently at runtime.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)