Skip to content

Commit 38e68ed

Browse files
committed
Don't verify that typeof form.submit is function before replacing it
That's apparently not a reliable thing to test for. Issue #927
1 parent 7f01029 commit 38e68ed

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/codemirror.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,15 +2236,13 @@ window.CodeMirror = (function() {
22362236
if (textarea.form) {
22372237
// Deplorable hack to make the submit method do the right thing.
22382238
var rmSubmit = connect(textarea.form, "submit", save, true);
2239-
if (typeof textarea.form.submit == "function") {
2240-
var realSubmit = textarea.form.submit;
2241-
textarea.form.submit = function wrappedSubmit() {
2242-
save();
2243-
textarea.form.submit = realSubmit;
2244-
textarea.form.submit();
2245-
textarea.form.submit = wrappedSubmit;
2246-
};
2247-
}
2239+
var realSubmit = textarea.form.submit;
2240+
textarea.form.submit = function wrappedSubmit() {
2241+
save();
2242+
textarea.form.submit = realSubmit;
2243+
textarea.form.submit();
2244+
textarea.form.submit = wrappedSubmit;
2245+
};
22482246
}
22492247

22502248
textarea.style.display = "none";

0 commit comments

Comments
 (0)