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

Unified Diff: chrome/browser/resources/downloads/downloads.js

Issue 668983004: Add <a is="action-link">, a web component extension of <a> for in-page actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 6 years, 2 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
Index: chrome/browser/resources/downloads/downloads.js
diff --git a/chrome/browser/resources/downloads/downloads.js b/chrome/browser/resources/downloads/downloads.js
index 75124aa47ab415e6fcd7675f7ce5306c2bccdac8..40ef566e13913a8759750257dd815cae54cb75e0 100644
--- a/chrome/browser/resources/downloads/downloads.js
+++ b/chrome/browser/resources/downloads/downloads.js
@@ -52,15 +52,13 @@ function showInlineBlock(node, isShow) {
/**
* Creates a link with a specified onclick handler and content.
* @param {function()} onclick The onclick handler.
- * @param {string} value The link text.
+ * @param {string=} opt_text The link text.
* @return {!Element} The created link element.
*/
-function createLink(onclick, value) {
- var link = document.createElement('a');
+function createLink(onclick, opt_text) {
aboxhall 2014/10/22 21:33:31 Perhaps this should be renamed createActionLink, t
Dan Beam 2014/10/23 03:05:44 Done.
+ var link = document.createElement('a', 'action-link');
link.onclick = onclick;
- link.href = '#';
- link.textContent = value;
- link.oncontextmenu = function() { return false; };
+ if (opt_text) link.textContent = opt_text;
return link;
}
@@ -330,7 +328,7 @@ function Download(download) {
this.nodeTitleArea_ = createElementWithClassName('div', 'title-area');
this.safe_.appendChild(this.nodeTitleArea_);
- this.nodeFileLink_ = createLink(this.openFile_.bind(this), '');
+ this.nodeFileLink_ = createLink(this.openFile_.bind(this));
this.nodeFileLink_.className = 'name';
this.nodeFileLink_.style.display = 'none';
this.nodeTitleArea_.appendChild(this.nodeFileLink_);
@@ -896,14 +894,10 @@ function load() {
clearAllHolder.hidden = true;
clearAllHolder.appendChild(clearAllElement);
- clearAllElement.oncontextmenu = function() { return false; };
- // TODO(jhawkins): Use a link-button here.
- var openDownloadsFolderLink = $('open-downloads-folder');
- openDownloadsFolderLink.onclick = function() {
+ $('open-downloads-folder').onclick = function() {
chrome.send('openDownloadsFolder');
};
- openDownloadsFolderLink.oncontextmenu = function() { return false; };
$('term').onsearch = function(e) {
setSearch($('term').value);
@@ -989,5 +983,3 @@ function tryDownloadUpdatedPeriodically() {
// Add handlers to HTML elements.
window.addEventListener('DOMContentLoaded', load);
-
-preventDefaultOnPoundLinkClicks(); // From util.js.

Powered by Google App Engine
This is Rietveld 408576698