1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-18 01:41:27 +01:00

Don't use deprecated initKeyEvent() for autofill (#2001)

This commit is contained in:
Mathew Hodson 2021-08-11 13:40:36 -04:00 committed by GitHub
parent 69c892807c
commit da12cbcd37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -835,12 +835,14 @@
document.elementForOPID = getElementByOpId; document.elementForOPID = getElementByOpId;
// normalize the event since firefox handles events differently than others // normalize the event based on API support
function normalizeEvent(el, eventName) { function normalizeEvent(el, eventName) {
var ev; var ev;
if (isFirefox) { if ('KeyboardEvent' in window) {
ev = document.createEvent('KeyboardEvent'); ev = new window.KeyboardEvent(eventName, {
ev.initKeyEvent(eventName, true, false, null, false, false, false, false, 0, 0); bubbles: true,
cancelable: false,
});
} }
else { else {
ev = el.ownerDocument.createEvent('Events'); ev = el.ownerDocument.createEvent('Events');