瀏覽代碼

JavaScript form validation compatibility older browsers (#6777)

Restore compatibility with older browsers (e.g. Firefox and Chrome older than 2020) and simplify code at the same time
https://developer.mozilla.org/en-US/docs/Web/API/SubmitEvent/submitter
Contributes to https://github.com/FreshRSS/FreshRSS/issues/6776
Was introduced by https://github.com/FreshRSS/FreshRSS/pull/4370 (to be retested a bit more, though)
Alexandre Alapetite 1 年之前
父節點
當前提交
229c78b2e3
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      p/scripts/extra.js

+ 1 - 1
p/scripts/extra.js

@@ -277,7 +277,7 @@ function init_2stateButton() {
 
 function init_configuration_alert() {
 	window.onsubmit = function (e) {
-		window.hasSubmit = data_leave_validation(document.body, e.submitter ? e.submitter.form : null);
+		window.hasSubmit = data_leave_validation(document.body, e.target);
 	};
 	window.onbeforeunload = function (e) {
 		if (window.hasSubmit) {