Skip to content

Commit 93841ba

Browse files
committed
maint: Early exit the SubmitEvent.submitter polyfill, if it is already available.
1 parent f532648 commit 93841ba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/core/polyfills.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
// SubmitEvent.submitter polyfill for Safari < 15.4 and jsDOM
44
// Original code: https://stackoverflow.com/a/61110260/1337474
55
// Also see: https://caniuse.com/?search=submitter
6-
//
6+
// NOTE: the `submitter` property is now widely available except for ancient browsers and jsDOM.
77
!(function () {
8+
if (window.SubmitEvent && "submitter" in window.SubmitEvent.prototype) {
9+
// `submitter` attribute is already supported.
10+
return;
11+
}
12+
813
let last_btn = null;
914
const submitable_buttons = `button, input[type="button"], input[type="submit"], input[type="image"]`;
1015
document.addEventListener(

0 commit comments

Comments
 (0)