Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-12143

Use newer JQuery release packaged by Wicket

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 13.4.1, 14.0.0
    • None
    • None
    • Turing
    • Turing Sprint 218, Turing Sprint 219

    Description

      Wicket 7 is shipped with JQuery 1.x, JQuery 2.x and JQuery 3.x. This can be found in the wicket-core-7.14.0.jar (currently the latest 7.x Wicket distribution we use), /org/apache/wicket/resource/jquery has jquery-1.12.4, jquery-2.2.4 & jquery-3.3.1.

       

      In the CMS  JQueryResourceReference is used to link to the JQuery library release, which takes 1.12.4. By changing to the DynamicJQueryResourceReference class, default jQuery will change to v2.2.4 (only for IE to fall back to 1.12.4)

      This can be done by adding the following line to the CMS Main class init method:

      getJavaScriptLibrarySettings().setJQueryReference(new DynamicJQueryResourceReference()); 

      Using JQuery 2.x is the expected behavior for Wicket 7.

      JQuery 3 is bundled with Wicket 7.x, for Wicket 8.x this will be the default, for Wicket 8 the DynamicJQueryResourceReference is deprecated.

       

      To mimic the Wicket 8.x behavior (unfortunately no constant is defined in Wicket 7.x with the jquery-3 resource path)

       

      public static final String VERSION_3 = "jquery/jquery-3.3.1.js";
      getJavaScriptLibrarySettings().setJQueryReference(new JavaScriptResourceReference(JQueryResourceReference.class, VERSION_3));
      

      When migrating to Wicket 8.x this can be replaced by getJavaScriptLibrarySettings().setJQueryReference(JQueryResourceReference.getV3());

       

      References

      https://github.com/apache/wicket/blob/wicket-7.x/wicket-core/src/main/java/org/apache/wicket/resource/DynamicJQueryResourceReference.java

      https://github.com/apache/wicket/blob/wicket-8.x/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              abanck Arent-Jan Banck (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: