Skip to content
Permalink
Browse files

Improve InputEvent feature test

Firefox 67 (in beta, currently) supports InputEvent, but doesn't dispatch "beforeinput" events. 🤔

Testing for Input​Event​.get​Target​Ranges() support fixes the false positive.
  • Loading branch information...
javan committed Apr 16, 2019
1 parent 43a24fa commit 5efabb52dc5f93cc34db65d9a789a92e47762fcb
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/trix/index.coffee.erb
@@ -19,8 +19,9 @@
forcesObjectResizing: /Trident.*rv:11/.test(navigator.userAgent)
# https://www.w3.org/TR/input-events-1/ + https://www.w3.org/TR/input-events-2/
supportsInputEvents: do ->
typeof InputEvent isnt "undefined" and
"inputType" of InputEvent.prototype and
"data" of InputEvent.prototype
return false if typeof InputEvent is "undefined"
for property in ["data", "getTargetRanges", "inputType"]
return false unless property of InputEvent.prototype
true

config: {}

1 comment on commit 5efabb5

@frankstallone

This comment has been minimized.

Copy link

commented on 5efabb5 Apr 17, 2019

Haha ohhh FF. 🥳

Please sign in to comment.
You can’t perform that action at this time.