1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-01 12:45:46 +01:00

Remove some redundant version-specific code.

This commit is contained in:
Doug Kearns
2014-02-08 00:05:35 +11:00
parent c8b430cd8f
commit 789b44209c
8 changed files with 54 additions and 115 deletions

View File

@@ -1354,38 +1354,26 @@ var DOM = Class("DOM", {
* @param {Node} target The DOM node to which to dispatch the event.
* @param {Event} event The event to dispatch.
*/
dispatch: Class.Memoize(function ()
config.haveGecko("2b")
? function dispatch(target, event, extra) {
try {
this.feedingEvent = extra;
dispatch: function dispatch(target, event, extra) {
try {
this.feedingEvent = extra;
if (target instanceof Ci.nsIDOMElement)
// This causes a crash on Gecko<2.0, it seems.
return (target.ownerDocument || target.document || target).defaultView
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.dispatchDOMEventViaPresShell(target, event, true);
else {
target.dispatchEvent(event);
return !event.defaultPrevented;
}
}
catch (e) {
util.reportError(e);
}
finally {
this.feedingEvent = null;
}
if (target instanceof Ci.nsIDOMElement)
return (target.ownerDocument || target.document || target).defaultView
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.dispatchDOMEventViaPresShell(target, event, true);
else {
target.dispatchEvent(event);
return !event.defaultPrevented;
}
: function dispatch(target, event, extra) {
try {
this.feedingEvent = extra;
target.dispatchEvent(update(event, extra));
}
finally {
this.feedingEvent = null;
}
})
}
catch (e) {
util.reportError(e);
}
finally {
this.feedingEvent = null;
}
}
}),
createContents: Class.Memoize(() => services.has("dactyl") && services.dactyl.createContents