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

        Sebastien Briquet created issue -
        Martin Grigorov made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Martin Grigorov [ mgrigorov ]
        Fix Version/s 6.7.0 [ 12323964 ]
        Resolution Fixed [ 1 ]
        Sebastien Briquet made changes -
        Attachment WICKET-5047-wicket-ajax-jquery.js.patch [ 12570655 ]
        Martin Grigorov made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Martin Grigorov made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Sebastien Briquet made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development