reiern70 opened a new pull request, #1580:
URL: https://github.com/apache/wicket/pull/1580

   Wicket's client-side Ajax/event support (Wicket.Ajax, Wicket.Event, 
Wicket.DOM, Wicket.Form, Wicket.Head, Wicket.Focus, ...) has always required 
jQuery. This adds a second, plain-JavaScript implementation exposing the exact 
same API, so applications that don't want to ship jQuery at all can opt in via:
   
       
getJavaScriptLibrarySettings().setWicketAjaxReference(WicketAjaxVanillaResourceReference.get());
   
   jQuery stays the default; existing applications are unaffected.
   
   Core changes:
   - wicket-ajax-vanilla.js: full port of wicket-ajax-jquery.js onto native 
XMLHttpRequest/DOM/event APIs (WicketAjaxVanillaResourceReference.java is its 
resource reference).
   - Removed jQuery from every other framework JS file that only used it 
incidentally (not as its actual implementation choice), so the whole stack can 
run without jQuery once the vanilla engine is selected: the extensions Ajax 
components (autocomplete, palette, upload progress bar, ajax download, trap 
focus), the dev debug bar, native WebSockets support, and 
FileUploadToResourceField.js - all verified to still work correctly under the 
default jQuery engine too, and their public extension points/callback 
signatures are unchanged.
   - Cleaned up several now-dead legacy-browser fallbacks and deprecated Web 
APIs encountered along the way (window.escape/unescape, window.event, 
Attr.specified, IE-only branches).
   
   Testing:
   - Ported the wicket-core QUnit suite 
(channels/dom/event/form/head/ajax/timer) off jQuery-based test-authoring 
helpers so the same tests run against either engine; all.html now takes 
?vanilla alongside the existing ?<jquery-version>, and the Gruntfile has a 
matching qunit:vanilla target.
   - Ran the full suite for real (jQuery 3.7.1, jQuery 4.0.0, vanilla) via a 
portable Node build + jsdom against a real HTTP server, since no JS runtime was 
available here otherwise - this caught and fixed several real bugs in the 
vanilla engine (event "extra data" colliding with native Event.detail, 
beforeSend's settings.url/data not reflecting the resolved request, unsupported 
dataType 'json', a DOM.show() default-display mismatch, and scripts in 
replaced/appended markup never executing).
   
   Examples:
   - wicket-examples can now be started with either engine via a single 
JVM-wide switch (-Dwicket.examples.use=JQUERY|VANILLA, default JQUERY), applied 
through AjaxEngineSelector from every example Application's init(), with a 
startup console banner (mirroring Wicket's own dev-mode warning) confirming 
which engine is active.
   - The shared example page header also shows the active engine and lets a 
visitor switch it for their session only, live, without an application restart 
- implemented via an IHeaderResponseDecorator rather than mutating the shared 
JavaScriptLibrarySettings, so concurrent sessions with different choices never 
interfere with each other. Verified end-to-end with WicketTester (both switch 
directions render the correct script tags in the correct order, and the toggle 
link updates the session as expected).
   
   Documentation: new user guide section (ajax_11.adoc) explaining both 
implementations and how to switch; corrected IAjaxCallListener/ajax_5/ajax_6 
docs that assumed jqXHR/jqEvent are always jQuery-specific objects.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to