Make submit event code work with both jQuery event and native event (#29223) (#29234)

Backport #29223 (no conflict)
This commit is contained in:
wxiaoguang 2024-02-18 14:36:41 +08:00 committed by GitHub
parent 7e0299b4fd
commit d41d367c35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View file

@ -58,7 +58,7 @@ function initRepoDiffConversationForm() {
const formData = new FormData($form[0]);
// if the form is submitted by a button, append the button's name and value to the form data
const submitter = submitEventSubmitter(e.originalEvent);
const submitter = submitEventSubmitter(e);
const isSubmittedByButton = (submitter?.nodeName === 'BUTTON') || (submitter?.nodeName === 'INPUT' && submitter.type === 'submit');
if (isSubmittedByButton && submitter.name) {
formData.append(submitter.name, submitter.value);