Hi Ernesto,

Technically speaking, it is possible to achieve the same using a div, or
even in a body script, but I do not like this idea too much. Using a header
contribution (with an head script) is the proper way to add a jQuery
template to the DOM...

But the main question is: should Wicket assume that a script header
contribution has a javascript content in any case?
As I said earlier, a script tag does not necessarily contains javascript.
It is the default scripting language for HTML5 (meaning type can be striped
from declaration) but there is a number of different possible values.

As for "official" values we can find:
text/javascript
text/ecmascript
text/vbscript
text/tcl

And for the known custom script mine type, at least:
text/x-handlebars
text/x-jquery-tmpl
text/x-kendo-template
text/x-underscore-template

That's the reason why I opened this thread because I think it is a
limitation that should be handled...

Thanks & best regards,
Sebastien.

On Sat, Feb 16, 2013 at 1:16 PM, Ernesto Reinaldo Barreiro <
[email protected]> wrote:

> Hi Sebastien,
>
> Wouldn't it be possible to achieve the same with a hidden div?
>
> On Sat, Feb 16, 2013 at 12:39 PM, Sebastien <[email protected]> wrote:
>
> > Dear Wicket's dev team,
> >
> > A user of wicket-jquery-ui, reported me an issue which is related to an
> > ajax inline javascript header contribution (when src attribute is not
> set)
> > https://github.com/sebfz1/wicket-jquery-ui/issues/20
> >
> > In wicket-ajax-jquery.js, #processScript assume that an inline script
> > should be added using Wicket.Head.addJavascript (in opposition to
> > Wicket.Head.addElement
> > for outline script)
> > The problem is that #addJavascript modifies the script content in any
> > case (content
> > = 'try{'+content+'}catch(e){Wicket.Log.error(e);}';), but a script
> element
> > does not necessary contains content that is designed to be executed, that
> > the case of a jQuery Template for instance where the tag signature look
> > like <script id="jquery-template-116997860" type="text/x-jquery-tmpl">
> >
> > I think that #processScript should ensure that the mime type is
> > 'text/javascript' before calling #addJavascript. If the mime type is
> > different, #addElement should be called rather than #addJavascript
> > Another option - if you want to prevent potential issues for user not
> > specifying the script's mime type - could be to bypass scripts (means not
> > calling #addJavascript but #addElement) having their mime type starting
> > with "text/x-", which is a convention for custom script type.
> >
> > Would you like me to open a jira ?
> >
> > Thanks in advance,
> > Sebastien.
> >
>
>
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ <http://antiliasoft.com/antilia>
>

Reply via email to