aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJez Ng2012-01-19 03:07:12 +0800
committerJez Ng2012-01-19 03:13:07 +0800
commitc522ba2e6b624e0c4364034a64605d4367f06d7b (patch)
tree06e8e5da54ed1a6ea63353943cf4825e50a10d97
parent469acff29be41e60eb8e1c24f007d435711d2b50 (diff)
downloadvimium-c522ba2e6b624e0c4364034a64605d4367f06d7b.tar.bz2
bubbleEvent should manage the native event propagation.
If the handlers do not want it bubbled up the internal stack, we can safely assume that they do not want it bubbled up the native stack as well. This fixes some problems e.g. with Google search pages.
-rw-r--r--bookmarks.js8
-rw-r--r--linkHints.js7
-rw-r--r--vimiumFrontend.js4
3 files changed, 7 insertions, 12 deletions
diff --git a/bookmarks.js b/bookmarks.js
index 9056c731..67ef1cb3 100644
--- a/bookmarks.js
+++ b/bookmarks.js
@@ -35,6 +35,7 @@ function activateBookmarkFindMode() {
handlerStack.push({
keydown: this.onKeydown,
+ keypress: this.onKeypress,
keyup: this.onKeyup
});
@@ -102,19 +103,16 @@ function activateBookmarkFindMode() {
// TODO(philc): Ignore keys that have modifiers.
if (isEscape(event))
self.disable();
-
- event.stopPropagation();
- event.preventDefault();
};
+ self.onKeypress = function(event) { return false; }
+
self.onKeyup = function(event) {
// shift key will toggle between new tab/same tab
if (event.keyCode == keyCodes.shiftKey && shiftWasPressedWhileToggled) {
self.invertNewTabSetting();
shiftWasPressedWhileToggled = false;
}
- event.stopPropagation();
- event.preventDefault();
};
}
diff --git a/linkHints.js b/linkHints.js
index f603add8..ce5b80ed 100644
--- a/linkHints.js
+++ b/linkHints.js
@@ -181,13 +181,10 @@ var linkHints = {
this.showMarker(linksMatched[i], this.markerMatcher.hintKeystrokeQueue.length);
}
}
-
- event.stopPropagation();
- event.preventDefault();
},
onKeyPressInMode: function(event) {
- return !this.delayMode;
+ return false;
},
onKeyUpInMode: function(event) {
@@ -199,8 +196,6 @@ var linkHints = {
this.setOpenLinkMode(!this.shouldOpenInNewTab, this.shouldOpenWithQueue, false);
this.openLinkModeToggle = false;
}
- event.stopPropagation();
- event.preventDefault();
},
/*
diff --git a/vimiumFrontend.js b/vimiumFrontend.js
index 6f02bb1c..283f8d08 100644
--- a/vimiumFrontend.js
+++ b/vimiumFrontend.js
@@ -401,8 +401,10 @@ function bubbleEvent(type, event) {
for (var i = handlerStack.length-1; i >= 0; i--) {
// We need to check for existence of handler because the last function call may have caused the release of
// more than one handler.
- if (handlerStack[i] && handlerStack[i][type] && !handlerStack[i][type](event))
+ if (handlerStack[i] && handlerStack[i][type] && !handlerStack[i][type](event)) {
+ suppressEvent(event);
return false;
+ }
}
return true;
}