Gecko is the last browser engine which does not support `beforeinput`
event. The event allows web apps to cancel user input **before**
updating the DOM tree, and web apps can modify the DOM tree as they
need. Web apps can know what's going on with `InputEvent.inputType`,
can know what's being inserted with `InputEvent.data` and
`InputEvent.dataTransfer`. They have already released for `input` event.
The new API, `InputEvent.getTargetRanges()` tells web apps where will be
modified with static ranges.
Note that Chrome supports Level 1, Safari supports Level 2 partially.
Due to spec issues of Level 2, we follow Chrome's implementation for now.
Currently landing early timing of the next cycle (83).
Bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1609291
Standard:
https://w3c.github.io/uievents/#event-type-beforeinput
https://rawgit.com/w3c/input-events/v1/index.html#event-type-beforeinput
https://w3c.github.io/input-events/#event-type-beforeinput
https://rawgit.com/w3c/input-events/v1/index.html#dom-inputevent-gettargetranges
https://w3c.github.io/input-events/#dom-inputevent-gettargetranges
Platform coverage:
All
Preference:
Both of them can be enabled by "dom.input_events.beforeinput.enabled"
Devtools support:
`beforeinput` event listener breakpoint has already been added.
Other browsers:
Chrome (Level 1) and Safari (Level 2 partially)
web-platform-tests:
none for `beforeinput` (because of it requires user input, and test
driver was not when other browsers implement it), but there are a lot of
tests for `getTargetRanges()` which I added (200+).
https://searchfox.org/mozilla-central/source/testing/web-platform/tests/input-events
(FYI: We have a lot of `beforeinput` event tests in mochitests:
https://searchfox.org/mozilla-central/search?q=%22beforeinput%22&path=%2Ftests%2F&case=true®exp=false)
Restricted to secure contexts: No
--
Masayuki Nakano <masay...@d-toybox.com>
Working on DOM, Events, editor and IME handling for Gecko
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform