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