Skip to content

Commit 3a3d3bc

Browse files
authored
Add event listeners in favor of overloading attributes (#80)
Overloading the onsubmit or onclick attribute and collide with other libraries that might do the same mistake. In this case the last executed script would overwrite the privious listener.
1 parent 495cf93 commit 3a3d3bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

s3file/static/s3file/js/s3file.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@
106106
})
107107
forms = new Set(forms)
108108
forms.forEach(form => {
109-
form.onsubmit = (e) => {
109+
form.addEventListener('submit', (e) => {
110110
e.preventDefault()
111111
uploadS3Inputs(e.target)
112-
}
112+
})
113113
let submitButtons = form.querySelectorAll('input[type=submit], button[type=submit]')
114114
Array.from(submitButtons).forEach(submitButton => {
115-
submitButton.onclick = clickSubmit
115+
submitButton.addEventListener('click', clickSubmit)
116116
}
117117
)
118118
})

0 commit comments

Comments
 (0)