reiern70 opened a new pull request, #1651: URL: https://github.com/apache/wicket/pull/1651
Fixes #1650. An `AjaxFormSubmitBehavior` whose `shouldTriggerJavaScriptSubmitEvent()` returns `true` fires a `submit` event on the form before its Ajax request (`UploadProgressBar` starts its bar from it). Since the jQuery-free engine (615af3ee95) the precondition fires it with `dispatchEvent()`. Firefox still submits a form for a submit event fired by a script unless the event is cancelled, so in Firefox the button sent its Ajax request **and** submitted the form normally, reloading the page behind the Ajax response. Chrome does not submit for such an event. The precondition now calls a new `Wicket.Event.triggerSubmit(form)`, in both `wicket-ajax-jquery.js` and `wicket-ajax.js`. It fires the event, tells whether a submit handler cancelled it, and cancels it once it has bubbled up to the window, so no browser submits the form. A handler cancelling the event still stops the Ajax request. Master only: Wicket 10.x triggers the event through jQuery and cancels it in its own handler, and was checked in Firefox not to submit. Tests: - QUnit `Wicket.Event.triggerSubmit` (4 tests in `event.js`), run in Chrome and Firefox with both engines. - `AjaxFormSubmitBehaviorTest.theSubmitEventIsTriggeredWithoutSubmittingTheForm`. - Checked by hand in Firefox 157 and Chrome with the Ajax upload example: one Ajax request, no reload. -- 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]
