diff --git a/app/javascript/src/legacy/common.coffee b/app/javascript/src/legacy/common.coffee index fb3b61d41..2b7d8cfdb 100644 --- a/app/javascript/src/legacy/common.coffee +++ b/app/javascript/src/legacy/common.coffee @@ -78,7 +78,7 @@ window.InitTextAreas = -> AllowTextAreaFields: true Element: elem }, (f) -> - $(form).simulate_submit() + form.requestSubmit() return return return @@ -89,24 +89,6 @@ window.InitAdvancedEditing = -> $(document.documentElement).removeClassName 'hide-advanced-editing' return -### When we resume a user submit after logging in, we want to run submit events, as -# if the submit had happened normally again, but submit() doesn't do this. Run -# a submit event manually. -### - -Element.addMethods 'FORM', simulate_submit: (form) -> - form = $(form) - if document.createEvent - e = document.createEvent('HTMLEvents') - e.initEvent 'submit', true, true - form.dispatchEvent e - if !e.stopped - form.submit() - else - if form.fireEvent('onsubmit') - form.submit() - return - window.onerror = (error, file, line) -> ReportError error, file, line, null return diff --git a/app/javascript/src/legacy/post.coffee b/app/javascript/src/legacy/post.coffee index 10685f3f2..1c1016455 100644 --- a/app/javascript/src/legacy/post.coffee +++ b/app/javascript/src/legacy/post.coffee @@ -219,7 +219,7 @@ window.Post = $(field_id).observe 'keydown', (e) -> if e.keyCode == Event.KEY_RETURN e.stop() - @up('form').simulate_submit() + @up('form').requestSubmit() return return get_post_tags_by_type: (post) ->