Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3248)

Unified Diff: chrome/browser/resources/shared/js/util.js

Issue 6250207: WebUI: Fix middle click link issue in click handler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only listen to click Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/shared/js/util.js
diff --git a/chrome/browser/resources/shared/js/util.js b/chrome/browser/resources/shared/js/util.js
index 63b3a8c3e36d2420c9c4ec5088dd5e5079d7f18a..ff75b0c527617a3e6bda845e60142d3b49dbb2a7 100644
--- a/chrome/browser/resources/shared/js/util.js
+++ b/chrome/browser/resources/shared/js/util.js
@@ -108,12 +108,9 @@ function swapDomNodes(a, b) {
aParent.insertBefore(b, afterA);
}
-/*
- * Handles a click or mouseup on a link. If the link points to a chrome: or
- * file: url, then call into the browser to do the navigation.
- * @return {Object} e The click or mouseup event.
- */
-function handleLinkClickOrMouseUp(e) {
+// Handle click on a link. If the link points to a chrome: or file: url, then
+// call into the browser to do the navigation.
+document.addEventListener('click', function(e) {
// Allow preventDefault to work.
if (!e.returnValue)
return;
@@ -126,14 +123,10 @@ function handleLinkClickOrMouseUp(e) {
}
if ((el.protocol == 'file:' || el.protocol == 'about:') &&
- ((e.button == 0 && e.type == 'click') ||
- (e.button == 1 && e.type == 'mouseup'))) {
+ (e.button == 0 || e.button == 1)) {
chrome.send('navigateToUrl',
[el.href, e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]);
e.preventDefault();
}
}
-}
-
-document.addEventListener('click', handleLinkClickOrMouseUp);
-document.addEventListener('mouseup', handleLinkClickOrMouseUp);
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698