Skip to content

Commit

Permalink
fix: use requestSubmit API if available
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Jan 27, 2024
1 parent 465d1ba commit 7dec961
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/conform-dom/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ export function requestSubmit(
'Failed to submit the form. The element provided is null or undefined.',
);

// if (typeof form.requestSubmit === 'function') {
// form.requestSubmit(submitter);
// } else {
const event = new SubmitEvent('submit', {
bubbles: true,
cancelable: true,
submitter,
});

form.dispatchEvent(event);
// }
if (typeof form.requestSubmit === 'function') {
form.requestSubmit(submitter);
} else {
const event = new SubmitEvent('submit', {
bubbles: true,
cancelable: true,
submitter,
});

form.dispatchEvent(event);
}
}

0 comments on commit 7dec961

Please sign in to comment.