Details
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