diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2017-12-28 00:01:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-28 00:01:42 -0500 |
commit | e525107108955b5b812825fc3c8c3aec9e1364d2 (patch) | |
tree | bcbf212b24a3505a09922fc19298880f08d3aa43 /actionview | |
parent | 41c8e41ff16b629ca520ccc3d098b440fa6df1ef (diff) | |
parent | 049a3374aa85f33091f0e7cba8635edd4b4786bd (diff) | |
download | rails-e525107108955b5b812825fc3c8c3aec9e1364d2.tar.gz rails-e525107108955b5b812825fc3c8c3aec9e1364d2.tar.bz2 rails-e525107108955b5b812825fc3c8c3aec9e1364d2.zip |
Merge pull request #31574 from Fudoshiki/patch-1
Fix IE 10 and IE 11's broken `preventDefault` for rails-ujs
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/app/assets/javascripts/rails-ujs/utils/event.coffee | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee b/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee index a2135c9851..c8fbc64b51 100644 --- a/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee +++ b/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee @@ -10,6 +10,11 @@ if typeof CustomEvent isnt 'function' CustomEvent = (event, params) -> evt = document.createEvent('CustomEvent') evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail) + # IE does not set `defaultPrevented` when `preventDefault()` is called on CustomEvents + # http://stackoverflow.com/questions/23349191/event-preventdefault-is-not-working-in-ie-11-for-custom-events + evt.preventDefault = -> + Object.defineProperty this, 'defaultPrevented', get: -> + true evt CustomEvent.prototype = window.Event.prototype |