Ticket #3717: InPlaceEditorSubmitOnBlurCrashOnSafari.diff
| File InPlaceEditorSubmitOnBlurCrashOnSafari.diff, 1.3 kB (added by ishikawa_takanori, 1 year ago) |
|---|
-
src/controls.js
old new 669 669 var size = this.options.size || this.options.cols || 0; 670 670 if (size != 0) textField.size = size; 671 671 if (this.options.submitOnBlur) 672 textField.onblur = this.on Submit.bind(this);672 textField.onblur = this.onBlur.bind(this); 673 673 this.editField = textField; 674 674 } else { 675 675 this.options.textarea = true; … … 681 681 textArea.cols = this.options.cols || 40; 682 682 textArea.className = 'editor_field'; 683 683 if (this.options.submitOnBlur) 684 textArea.onblur = this.on Submit.bind(this);684 textArea.onblur = this.onBlur.bind(this); 685 685 this.editField = textArea; 686 686 } 687 687 … … 723 723 } 724 724 return false; 725 725 }, 726 onBlur: function() { 727 // needed to prevent crash on Safari when clicking focus ring. 728 setTimeout(function() { 729 // Both okButton and cancelLink fires onblur event (cause duplicate submit), 730 // so sanity check before submitting. 731 if (!this.form || this.saving) return false; 732 this.onSubmit(); 733 }.bind(this), 100); 734 }, 726 735 onSubmit: function() { 727 736 // onLoading resets these so we need to save them away for the Ajax call 728 737 var form = this.form;