Permalink
Browse files

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

Closes #1056
  • Loading branch information...
1 parent b3b07c6 commit 98d0247629c65e6c4ccf42c4e75b71bcb292f60e @marijnh marijnh committed Dec 7, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/codemirror.js
View
@@ -2252,12 +2252,12 @@ window.CodeMirror = (function() {
if (textarea.form) {
// Deplorable hack to make the submit method do the right thing.
var rmSubmit = connect(textarea.form, "submit", save, true);
- var realSubmit = textarea.form.submit;
+ var form = textarea.form, realSubmit = form.submit;
textarea.form.submit = function wrappedSubmit() {
save();
- textarea.form.submit = realSubmit;
- textarea.form.submit();
- textarea.form.submit = wrappedSubmit;
+ form.submit = realSubmit;
+ form.submit();
+ form.submit = wrappedSubmit;
};
}

0 comments on commit 98d0247

Please sign in to comment.