mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 11:08:09 +01:00
Add canceled property to DOM instances. Remove stray util.haveGecko call.
This commit is contained in:
@@ -1287,7 +1287,7 @@ var Buffer = Module("buffer", {
|
||||
if (top != null)
|
||||
elem.scrollTop = top;
|
||||
|
||||
if (config.haveGecko("2.0") && !util.haveGecko("7.*"))
|
||||
if (config.haveGecko("2.0") && !config.haveGecko("7.*"))
|
||||
elem.ownerDocument.defaultView
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
|
||||
.redraw();
|
||||
|
||||
@@ -294,7 +294,7 @@ var MOW = Module("mow", {
|
||||
if (!value && elem && elem.contentWindow == document.commandDispatcher.focusedWindow) {
|
||||
|
||||
let focused = content.document.activeElement;
|
||||
if (Events.isInputElement(focused))
|
||||
if (focused && Events.isInputElement(focused))
|
||||
focused.blur();
|
||||
|
||||
document.commandDispatcher.focusedWindow = content;
|
||||
|
||||
@@ -1069,7 +1069,6 @@ function Module(name, prototype) {
|
||||
let proto = arguments[callable(prototype) ? 2 : 1];
|
||||
|
||||
proto._metaInit_ = function () {
|
||||
dump("_metaInit_ " + name + " " + currentModule.NAME + " " + this + "\n");
|
||||
delete module.prototype._metaInit_;
|
||||
currentModule[name.toLowerCase()] = this;
|
||||
};
|
||||
|
||||
@@ -1585,7 +1585,7 @@ var DOM = Class("DOM", {
|
||||
yield this.eq(i);
|
||||
},
|
||||
|
||||
get document() this._document || this[0].ownerDocument,
|
||||
get document() this._document || this[0].ownerDocument || this[0].document || this[0],
|
||||
set document(val) this._document = val,
|
||||
|
||||
attrHooks: array.toObject([
|
||||
@@ -2191,9 +2191,11 @@ var DOM = Class("DOM", {
|
||||
},
|
||||
|
||||
dispatch: function dispatch(event, params, extraProps) {
|
||||
this.canceled = false;
|
||||
return this.each(function (elem) {
|
||||
let evt = DOM.Event(this.document, event, params);
|
||||
DOM.Event.dispatch(elem, evt, extraProps);
|
||||
if (!DOM.Event.dispatch(elem, evt, extraProps))
|
||||
this.canceled = true;
|
||||
}, this);
|
||||
},
|
||||
|
||||
@@ -2271,24 +2273,30 @@ var DOM = Class("DOM", {
|
||||
};
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
var t = this.constructor.types[type];
|
||||
var evt = doc.createEvent((t || "HTML") + "Events");
|
||||
|
||||
let defaults = DEFAULTS[t || "HTML"];
|
||||
update(defaults, this.constructor.defaults[type]);
|
||||
|
||||
let args = Object.keys(defaults)
|
||||
.map(function (k) k in opts ? opts[k] : defaults[k]);
|
||||
.map(function (k) k in opts ? opts[k] : defaults[k])
|
||||
|
||||
evt["init" + t + "Event"].apply(evt, args);
|
||||
return evt;
|
||||
}
|
||||
}, {
|
||||
defaults: {
|
||||
load: { bubbles: false },
|
||||
submit: { cancelable: true }
|
||||
},
|
||||
|
||||
types: Class.memoize(function () iter(
|
||||
{
|
||||
Mouse: "click mousedown mouseout mouseover mouseup",
|
||||
Key: "keydown keypress keyup",
|
||||
"": "change dactyl-input input submit"
|
||||
"": "change dactyl-input input submit " +
|
||||
"load unload pageshow pagehide DOMContentLoaded"
|
||||
}
|
||||
).map(function ([k, v]) v.split(" ").map(function (v) [v, k]))
|
||||
.flatten()
|
||||
|
||||
Reference in New Issue
Block a user