Wicket
  1. Wicket
  2. WICKET-5047

Wicket Ajax: Inline script header contribution issue

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.5.0
    • Fix Version/s: 6.7.0
    • Component/s: wicket
    • Labels:
      None

      Description

      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.

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Martin Grigorov
            Reporter:
            Sebastien Briquet
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development