summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-01-15 18:24:02 -0500
committerKris Maglione <maglione.k@gmail.com>2011-01-15 18:24:02 -0500
commiteacd52dffb88482a493dd98c29a5a092c8dd6227 (patch)
treefedd5d2725f92ce9a018f7c1b6c771bb5eee5098
parent83778a8e16fc42f12b732b940643199bf78f7601 (diff)
downloadpentadactyl-eacd52dffb88482a493dd98c29a5a092c8dd6227.tar.gz
Send "change" event when editing file upload boxes.
-rw-r--r--common/content/buffer.js1
-rw-r--r--common/content/events.js8
2 files changed, 7 insertions, 2 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index 877e30c0..4ee88ba2 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -1197,6 +1197,7 @@ var Buffer = Module("buffer", {
dactyl.assert(file.exists());
elem.value = file.path;
+ events.dispatch(elem, events.create(elem.ownerDocument, "change", {}));
}, {
completer: function (context) completion.file(context),
default: elem.value
diff --git a/common/content/events.js b/common/content/events.js
index 6fe35884..ee9e4a2e 100644
--- a/common/content/events.js
+++ b/common/content/events.js
@@ -335,6 +335,9 @@ var Events = Module("events", {
*/
create: function (doc, type, opts) {
var DEFAULTS = {
+ HTML: {
+ type: type, bubbles: true, cancelable: false
+ },
Key: {
type: type,
bubbles: true, cancelable: true,
@@ -355,14 +358,15 @@ var Events = Module("events", {
}
};
const TYPES = {
+ change: "",
click: "Mouse", mousedown: "Mouse", mouseup: "Mouse",
mouseover: "Mouse", mouseout: "Mouse",
keypress: "Key", keyup: "Key", keydown: "Key"
};
var t = TYPES[type];
- var evt = doc.createEvent(t + "Events");
+ var evt = doc.createEvent((t || "HTML") + "Events");
evt["init" + t + "Event"].apply(evt,
- [v for ([k, v] in Iterator(util.extend(DEFAULTS[t], opts)))]);
+ [v for ([k, v] in Iterator(util.extend(DEFAULTS[t || "HTML"], opts)))]);
return evt;
},