Supports Safari in form submission event

This commit is contained in:
Mouse Reeve 2021-09-12 11:45:18 -07:00
parent bee1b2a2eb
commit 7cfb0a4271

View file

@ -64,9 +64,19 @@ let StatusCache = new class {
* @return {undefined} * @return {undefined}
*/ */
submitStatus(event) { submitStatus(event) {
event.preventDefault();
const form = event.currentTarget; const form = event.currentTarget;
const trigger = event.submitter; let trigger = event.submitter;
// Safari doesn't understand "submitter"
if (!trigger) {
trigger = event.currentTarget.querySelector("button[type=submit]");
}
// this allows the form to submit in the old fashioned way if there's a problem
if (!trigger || !form) {
return;
}
event.preventDefault();
BookWyrm.addRemoveClass(form, 'is-processing', true); BookWyrm.addRemoveClass(form, 'is-processing', true);
trigger.setAttribute('disabled', null); trigger.setAttribute('disabled', null);