mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 08:57:59 +01:00
Send "change" event when editing file upload boxes.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user