Index: chrome/browser/resources/md_downloads/crisper.js |
diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js |
index 2d17f3a17ee86921ff069832066d8986932d700a..9d05ffdd5ae91cee082c934bf619d13186c33f6b 100644 |
--- a/chrome/browser/resources/md_downloads/crisper.js |
+++ b/chrome/browser/resources/md_downloads/crisper.js |
@@ -1360,31 +1360,33 @@ function queryRequiredElement(selectors, opt_context) { |
// 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) { |
- if (e.defaultPrevented) |
- return; |
- |
- var el = e.target; |
- if (el.nodeType == Node.ELEMENT_NODE && |
- el.webkitMatchesSelector('A, A *')) { |
- while (el.tagName != 'A') { |
- el = el.parentElement; |
- } |
+['click', 'auxclick'].forEach(function(eventName) { |
+ document.addEventListener(eventName, function(e) { |
+ if (e.defaultPrevented) |
+ return; |
- if ((el.protocol == 'file:' || el.protocol == 'about:') && |
- (e.button == 0 || e.button == 1)) { |
- chrome.send('navigateToUrl', [ |
- el.href, |
- el.target, |
- e.button, |
- e.altKey, |
- e.ctrlKey, |
- e.metaKey, |
- e.shiftKey |
- ]); |
- e.preventDefault(); |
+ var el = e.target; |
+ if (el.nodeType == Node.ELEMENT_NODE && |
+ el.webkitMatchesSelector('A, A *')) { |
+ while (el.tagName != 'A') { |
+ el = el.parentElement; |
+ } |
+ |
+ if ((el.protocol == 'file:' || el.protocol == 'about:') && |
+ (e.button == 0 || e.button == 1)) { |
+ chrome.send('navigateToUrl', [ |
+ el.href, |
+ el.target, |
+ e.button, |
+ e.altKey, |
+ e.ctrlKey, |
+ e.metaKey, |
+ e.shiftKey |
+ ]); |
+ e.preventDefault(); |
+ } |
} |
- } |
+ }); |
}); |
/** |
@@ -11917,4 +11919,4 @@ cr.define('downloads', function() { |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-window.addEventListener('load', downloads.Manager.onLoad); |
+window.addEventListener('load', downloads.Manager.onLoad); |