Skip to content
Browse files

Don't assume textarea.form will stay the same in fromTextArea

Closes #1056
  • Loading branch information...
1 parent c59d7b2 commit a7c53fdd9f4df13693a49d04aea7f398406a7e8d @marijnh marijnh committed
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/codemirror.js
View
10 lib/codemirror.js
@@ -3101,13 +3101,13 @@ window.CodeMirror = (function() {
if (textarea.form) {
// Deplorable hack to make the submit method do the right thing.
on(textarea.form, "submit", save);
- var realSubmit = textarea.form.submit;
+ var form = textarea.form, realSubmit = form.submit;
try {
- textarea.form.submit = function wrappedSubmit() {
+ form.submit = function wrappedSubmit() {
save();
- textarea.form.submit = realSubmit;
- textarea.form.submit();
- textarea.form.submit = wrappedSubmit;
+ form.submit = realSubmit;
+ form.submit();
+ form.submit = wrappedSubmit;
};
} catch(e) {}
}

0 comments on commit a7c53fd

Please sign in to comment.
Something went wrong with that request. Please try again.