Looks good! One nit: the commit message mentions twice 'should*Trigger*JavaScriptSubmitEvent' while the latter should be 'should*Invoke*JavaScriptFormOnsubmit' You can fix it in 'csp' branch before merging to master
On Wed, Feb 5, 2020 at 11:22 PM Emond Papegaaij <[email protected]> wrote: > This is what I have in mind: > > https://github.com/apache/wicket/commit/b54938053a5bda2f4577966779d580e828f16e47 > > I think this is better than the old situation because this triggers > any submit handlers on the form (or any parent element via bubbling) > not just the onsubmit attribute. It is a change in behavior though and > might break existing applications. > > Emond > > On Wed, Feb 5, 2020 at 10:01 PM Emond Papegaaij > <[email protected]> wrote: > > > > On Wed, Feb 5, 2020 at 9:57 PM Emond Papegaaij > > <[email protected]> wrote: > > > While fixing the CSP violations in the examples, I noticed a strange > > > situation in SubmitLink example: > > > > http://examples8x.wicket.apache.org/compref/wicket/bookmarkable/org.apache.wicket.examples.compref.SubmitLinkPage > > > > > > In this example, the internal submit link immediately submits the > > > form, while the external submit link shows a confirmation. This > > > confirmation is specified via an onsubmit on the form in the markup. > > > The JS for the external link explicitly checks onsubmit and calls > > > this, while the internal link does not check the onsubmit attribute. I > > > think these should match, and I would like to replace the f.submit() > > > call with a proper submit event trigger via Wicket.Event.fire(f, > > > 'submit'). > > > > > > Does anyone know why this discrepancy exists, or is it merely an > oversight? > > > > Doh, I can answer this myself, it's controlled via > > shouldInvokeJavaScriptFormOnsubmit. Unfortunately, that does not work > > with a strict CSP. What about changing this method to control the > > switch between 'f.submit()' and 'Wicket.Event.fire(f, 'submit')'? The > > first will not trigger any event bindings, the second will. For this, > > the name of the method should be adjusted accordingly. > > > > Best regards, > > Emond >
