You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sebastien Briquet (JIRA)" <ji...@apache.org> on 2013/02/18 23:29:12 UTC

[jira] [Created] (WICKET-5047) Wicket Ajax: Inline script header contribution issue

Sebastien Briquet created WICKET-5047:
-----------------------------------------

             Summary: Wicket Ajax: Inline script header contribution issue
                 Key: WICKET-5047
                 URL: https://issues.apache.org/jira/browse/WICKET-5047
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.5.0
            Reporter: Sebastien Briquet


wicket-ajax-jquery.js#processScript adds an *inline* script using Wicket.Head.addJavascript, in opposition to Wicket.Head.addElement for an outline script.

The problem is that #addJavascript modifies the script content in any case, with: content = 'try{'+content+'}catch(e){Wicket.Log.error(e);}';

But a script element may contains content that is *not* designed to be executed nor be javascript: that's the case of a jQuery Template for instance (where the tag signature look like <script id="my-id" type="text/x-jquery-tmpl">). That's also true for other known mine/type, like text/ecmascript, text/vbscript, text/tcl. And for customized ones, at least: text/x-handlebars, text/x-kendo-template, text/x-underscore-template...

Therefore, I think ajax wicket should add script elements using #addJavascript, only if the mime type is text/javascript or is empty (because it is the default scripting language in HTML5 and the declaration can be omitted). In the other cases, it should add the script element to the DOM "as-is", using #addElement.

Thanks in advance & best regards,
Sebastien.

--
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