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

Unified Diff: chrome/common/extensions/docs/examples/extensions/buildbot/popup.html

Issue 411008: Remove use of innerHTML and Toolstrips from example extensions (Closed)
Patch Set: cr changes Created 11 years, 1 month 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/common/extensions/docs/examples/extensions/buildbot/popup.html
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
index d5b913d3456aa0af6e72d2b4c3c2b5d9aad0548d..607f6a4d5aeb3d8803de728889e0c6f3d7bdb052 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
@@ -36,20 +36,34 @@ function updateBotList(text) {
}
function displayFailures() {
- var html = "";
+ bots.innerText = "";
+
if (failures.length == 0) {
- html = "<a href='' onclick='showConsole()' class='open'>" +
- "The tree is completely green.</a> (no way!)";
+ var anchor = document.createElement("a");
+ anchor.addEventListener("click", showConsole);
+ anchor.className = "open";
+ anchor.innerText = "The tree is completely green.";
+ bots.appendChild(anchor);
+ bots.appendChild(document.createTextNode(" (no way!)"));
} else {
- html = "<div><a class='closed' href='' onclick='showFailures()'>" +
- "failures:</a></div>";
+ var anchor = document.createElement("a");
+ anchor.addEventListener("click", showFailures);
+ anchor.innerText = "failures:";
+ var div = document.createElement("div");
+ div.appendChild(anchor);
+ bots.appendChild(div);
+
failures.forEach(function(bot, i) {
- html += "<div class='bot " + bot.color +
- "' onclick='showBot(" + i + ")'>" +
- bot.title + "</div>";
+ var div = document.createElement("div");
+ div.className = "bot " + bot.color;
+ div.addEventListener("click", function() {
+ // Requires closure for each iteration to retain local value of |i|.
+ return function() { showBot(i); }
+ }());
+ div.innerText = bot.title;
+ bots.appendChild(div);
});
}
- bots.innerHTML = html;
}
function showURL(url) {
@@ -79,7 +93,8 @@ function showFyi() {
}
function showFailures() {
- var url = botRoot + "/waterfall/waterfall?show_events=true&failures_only=true";
+ var url = botRoot +
+ "/waterfall/waterfall?show_events=true&failures_only=true";
showURL(url);
}

Powered by Google App Engine
This is Rietveld 408576698