[Pkg-mozext-commits] [autofill-forms] 04/13: improving onchange
David Prévot
taffit at moszumanska.debian.org
Thu Oct 29 20:57:37 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository autofill-forms.
commit e352966929652bd38459ca94b25d70081743c9b4
Author: Sarah Avilov <sarah.avilov at gmail.com>
Date: Sun Jul 12 14:05:15 2015 +0430
improving onchange
---
aff.xpi | Bin 152537 -> 152578 bytes
chrome/content/autofillForms.js | 3 ++-
chrome/content/inject.js | 16 +++++++++++++---
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/aff.xpi b/aff.xpi
index 0692053..5b06a64 100644
Binary files a/aff.xpi and b/aff.xpi differ
diff --git a/chrome/content/autofillForms.js b/chrome/content/autofillForms.js
index 1778d65..d11ae4f 100644
--- a/chrome/content/autofillForms.js
+++ b/chrome/content/autofillForms.js
@@ -5085,7 +5085,8 @@ var autofillForms = {
this.currentRuleField.value = str;
// Call the onchange handler:
if(this.currentRuleField.onchange) {
- this.currentRuleField.onchange();
+ //this.currentRuleField.onchange();
+ autofillForms.action(this.currentRuleField, 'change');
}
// Call the focus handler:
if(this.currentRuleField.focus) {
diff --git a/chrome/content/inject.js b/chrome/content/inject.js
index f25b733..719f2f0 100644
--- a/chrome/content/inject.js
+++ b/chrome/content/inject.js
@@ -2,9 +2,12 @@
'use strict';
function onchange (elem) {
- var evt = content.document.createEvent('HTMLEvents');
- evt.initEvent('change', true, true);
- elem.dispatchEvent(evt);
+ try {
+ var evt = content.document.createEvent('HTMLEvents');
+ evt.initEvent('change', true, true);
+ elem.dispatchEvent(evt);
+ }
+ catch (e) {}
}
addMessageListener('click', function () {
@@ -29,6 +32,13 @@ addMessageListener('focus', function () {
onchange(elem);
});
});
+addMessageListener('change', function () {
+ var elems = content.document.querySelectorAll('[data-aff-change=true]');
+ [].forEach.call(elems, function (elem) {
+ elem.removeAttribute('data-aff-change');
+ elem.onchange();
+ });
+});
addMessageListener('value', function () {
var elems = content.document.querySelectorAll('[data-aff-value]');
[].forEach.call(elems, function (elem) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/autofill-forms.git
More information about the Pkg-mozext-commits
mailing list