From 52601e30de20cccf69d88bfe367b2e8ab499c6a1 Mon Sep 17 00:00:00 2001 From: satyr Date: Sun, 14 Mar 2010 09:21:17 +0900 Subject: [PATCH] Removed pointless event capturings. Fixed misplaced returns. --- ubiquity/chrome/content/ubiquity.js | 8 ++++---- ubiquity/modules/cmdmanager.js | 15 +++++++-------- ubiquity/modules/utils.js | 1 - 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ubiquity/chrome/content/ubiquity.js b/ubiquity/chrome/content/ubiquity.js index 1ff34714..01f68e26 100644 --- a/ubiquity/chrome/content/ubiquity.js +++ b/ubiquity/chrome/content/ubiquity.js @@ -64,15 +64,15 @@ function Ubiquity(msgPanel, textBox, cmdManager) { window.addEventListener("mousemove", this, false); - textBox.addEventListener("keydown", this, true); - textBox.addEventListener("keypress", this, true); - textBox.addEventListener("keyup", this, true); + textBox.addEventListener("keydown", this, false); + textBox.addEventListener("keypress", this, false); + textBox.addEventListener("keyup", this, false); if (this.Utils.OS === "WINNT") textBox.addEventListener("blur", this, false); msgPanel.addEventListener("popupshowing", this, false); msgPanel.addEventListener("popupshown", this, false); msgPanel.addEventListener("popuphidden", this, false); - msgPanel.addEventListener("click", this, true); + msgPanel.addEventListener("click", this, false); var self = this; self.__onSuggestionsUpdated = function U__onSuggestionsUpdated() { diff --git a/ubiquity/modules/cmdmanager.js b/ubiquity/modules/cmdmanager.js index 2b3f2407..1c565f2f 100755 --- a/ubiquity/modules/cmdmanager.js +++ b/ubiquity/modules/cmdmanager.js @@ -118,8 +118,8 @@ function CommandManager(cmdSource, msgService, parser, if (parser) this._loadCommands(); this.setPreviewState("no-suggestions"); - suggDoc.addEventListener("click", this, true); - suggDoc.addEventListener("DOMMouseScroll", this, true); + suggDoc.addEventListener("click", this, false); + suggDoc.addEventListener("DOMMouseScroll", this, false); } CommandManager.prototype = { @@ -135,16 +135,15 @@ CommandManager.prototype = { if (this.__hilitedIndex === index) return; this.__hilitedIndex = index; this.__lastAsyncSuggestionCb(); - break; - } + } break; case "DOMMouseScroll": { this[event.detail < 0 ? "moveIndicationUp" : "moveIndicationDown"](); this.__lastAsyncSuggestionCb(); - break; - } - event.preventDefault(); - event.stopPropagation(); + } break; + default: return; } + event.preventDefault(); + event.stopPropagation(); }, setPreviewState: function CM_setPreviewState(state) { diff --git a/ubiquity/modules/utils.js b/ubiquity/modules/utils.js index 2a9b0b5b..d4683456 100755 --- a/ubiquity/modules/utils.js +++ b/ubiquity/modules/utils.js @@ -1222,7 +1222,6 @@ function regexp(pattern, flags) { } catch (e if e instanceof SyntaxError) { return RegExp(regexp.quote(pattern), flags); } - return RegExp(); } // === {{{ Utils.regexp.quote(string) }}} ===