mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 03:07:58 +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());
|
dactyl.assert(file.exists());
|
||||||
|
|
||||||
elem.value = file.path;
|
elem.value = file.path;
|
||||||
|
events.dispatch(elem, events.create(elem.ownerDocument, "change", {}));
|
||||||
}, {
|
}, {
|
||||||
completer: function (context) completion.file(context),
|
completer: function (context) completion.file(context),
|
||||||
default: elem.value
|
default: elem.value
|
||||||
|
|||||||
@@ -335,6 +335,9 @@ var Events = Module("events", {
|
|||||||
*/
|
*/
|
||||||
create: function (doc, type, opts) {
|
create: function (doc, type, opts) {
|
||||||
var DEFAULTS = {
|
var DEFAULTS = {
|
||||||
|
HTML: {
|
||||||
|
type: type, bubbles: true, cancelable: false
|
||||||
|
},
|
||||||
Key: {
|
Key: {
|
||||||
type: type,
|
type: type,
|
||||||
bubbles: true, cancelable: true,
|
bubbles: true, cancelable: true,
|
||||||
@@ -355,14 +358,15 @@ var Events = Module("events", {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const TYPES = {
|
const TYPES = {
|
||||||
|
change: "",
|
||||||
click: "Mouse", mousedown: "Mouse", mouseup: "Mouse",
|
click: "Mouse", mousedown: "Mouse", mouseup: "Mouse",
|
||||||
mouseover: "Mouse", mouseout: "Mouse",
|
mouseover: "Mouse", mouseout: "Mouse",
|
||||||
keypress: "Key", keyup: "Key", keydown: "Key"
|
keypress: "Key", keyup: "Key", keydown: "Key"
|
||||||
};
|
};
|
||||||
var t = TYPES[type];
|
var t = TYPES[type];
|
||||||
var evt = doc.createEvent(t + "Events");
|
var evt = doc.createEvent((t || "HTML") + "Events");
|
||||||
evt["init" + t + "Event"].apply(evt,
|
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;
|
return evt;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user