fix(extension) fires JS event upon editing input fields (#575)
This commit is contained in:
parent
1307dc77c5
commit
32fdea0206
1 changed files with 15 additions and 0 deletions
|
|
@ -1,5 +1,16 @@
|
|||
var PassProcessor = function() {};
|
||||
|
||||
/**
|
||||
* Dispatches a synthetic event of a given type on a given element.
|
||||
* @param {string} type the event type to dispatch
|
||||
* @param {Element} el the element upon which to dispatch it
|
||||
*/
|
||||
var dispatchEvent = function(type, el) {
|
||||
var evt = document.createEvent('Event');
|
||||
evt.initEvent(type, true, true);
|
||||
el.dispatchEvent(evt);
|
||||
};
|
||||
|
||||
PassProcessor.prototype = {
|
||||
run: function(arguments) {
|
||||
var url
|
||||
|
|
@ -19,6 +30,8 @@ finalize: function(arguments) {
|
|||
if (passwordElement) {
|
||||
passwordElement.setAttribute('value', arguments["password"])
|
||||
passwordElement.value = arguments["password"]
|
||||
dispatchEvent("input", passwordElement)
|
||||
dispatchEvent("change", passwordElement)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -27,6 +40,8 @@ finalize: function(arguments) {
|
|||
if (usernameElement) {
|
||||
usernameElement.setAttribute('value', arguments["username"])
|
||||
usernameElement.value = arguments["username"]
|
||||
dispatchEvent("input", usernameElement)
|
||||
dispatchEvent("change", usernameElement)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue