Closed mbutov closed 11 years ago
Hi Maxim,
Thanks for reporting and for the ready to use showcase! (very helpful) The prime investigation lets revealing that the wicket's ajax is changing the content type (and then the content) of the script once received client side...
The Ajax debug window indicates that the header-contribution
is correct:
<header-contribution encoding="wicket1" >
...
<script id="jquery-template-116997860" type="text/x-jquery-tmpl">
<a>custom template for ${value}</a>
</script>
...
</header-contribution>
But the script attached to the dom is slightly different:
<script id="jquery-template-116997860" src_="undefined" type="text/javascript">
try{<a>custom template for ${value}</a>}catch(e){Wicket.Log.error(e);}
</script>
The key-point here is that the content type changed from text/x-jquery-tmpl
to text/javascript
.
This modification makes wicket-ajax-jquery.js#addJavascript
method to transform the content, that's what we see just above.
I did not find yet how/when/why the content type changes. I will investigate a little bit further to make sure I did not missed something, and then will request to open an issue on wicket's jira.
Thanks & best regards, Sebastien.
Just a little correction about my comment above, #addJavascript
changes the mime-type to text/javascript
, this is not the inverse. Actually, every inline scripts are added to the DOM thought #addJavascript
, regardless to the mime-type.
The issue has been opened on Wicket's JIRA: https://issues.apache.org/jira/browse/WICKET-5047
Thanks, Sebastien.
The JIRA ticket has been resolved on Wicket 6.7.0 (-SNAPSHOT)
Steps to reproduce.
Suppose there is a page with some container, which is updated with ajax. Execute an ajax action on the page. In the Wicket's ajax target add AutoCompleteTextField with custom template (overriden method
protected IJQueryTemplate newTemplate()
which returns some template). Then in the choice div we'll have:A sample application showing this bug is created here: wicket-jquery-ui-autocomplete-bug.