Index: ui/webui/resources/js/util.js |
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js |
index 293205804389a21425c26bc0c26756533d9e42ea..821929ce96cd6f4c8c198b240ce5a0a94ded4dd6 100644 |
--- a/ui/webui/resources/js/util.js |
+++ b/ui/webui/resources/js/util.js |
@@ -212,31 +212,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; |
+ |
+ 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(); |
+ 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(); |
+ } |
} |
- } |
+ }); |
}); |
/** |