summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-08-15 13:57:13 -0400
committerKris Maglione <maglione.k@gmail.com>2011-08-15 13:57:13 -0400
commit01fd946df1a7bd89528ec4c7cdfff9fde38d00ab (patch)
tree4e5857ec8d1acbccb306f1989229d250703ba609
parent9d87ed9454e5bd9950b70dd6171c7f8b2bcf955e (diff)
downloadpentadactyl-01fd946df1a7bd89528ec4c7cdfff9fde38d00ab.tar.gz
Add canceled property to DOM instances. Remove stray util.haveGecko call.
-rw-r--r--common/content/buffer.js2
-rw-r--r--common/content/mow.js2
-rw-r--r--common/modules/base.jsm1
-rw-r--r--common/modules/util.jsm18
4 files changed, 15 insertions, 8 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js
index 78dcd824..8afff7e5 100644
--- a/common/content/buffer.js
+++ b/common/content/buffer.js
@@ -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();
diff --git a/common/content/mow.js b/common/content/mow.js
index b02c00c9..391feeaf 100644
--- a/common/content/mow.js
+++ b/common/content/mow.js
@@ -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;
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index 047bb6fd..b7b7d441 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -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;
};
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index c33b55c1..7bc226c7 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -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()