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

Unified Diff: chrome/common/extensions/docs/examples/api/messaging/timer/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/api/messaging/timer/popup.html
diff --git a/chrome/common/extensions/docs/examples/api/messaging/timer/popup.html b/chrome/common/extensions/docs/examples/api/messaging/timer/popup.html
index 315baffa731010f487dbeace9433c27e87e04138..5f7e2b4a8769062f2c2db6dbec1d6b9f98165c61 100644
--- a/chrome/common/extensions/docs/examples/api/messaging/timer/popup.html
+++ b/chrome/common/extensions/docs/examples/api/messaging/timer/popup.html
@@ -6,13 +6,17 @@ tr {
.results {
text-align: right;
min-width: 6em;
+ color: black;
}
</style>
<script>
-// Tests the roundtrip time of sendRquest().
+function setChildTextNode(elementId, text) {
+ document.getElementById(elementId).innerText = text;
+}
+
+// Tests the roundtrip time of sendRequest().
function testRequest() {
- var results = document.getElementById("resultsRequest");
- results.innerHTML = "running...";
+ setChildTextNode("resultsRequest", "running...");
chrome.tabs.getSelected(null, function(tab) {
var timer = new chromium.Interval();
@@ -24,7 +28,7 @@ function testRequest() {
} else {
timer.stop();
var usec = Math.round(timer.microseconds() / response.counter);
- results.innerHTML = usec + "usec";
+ setChildTextNode("resultsRequest", usec + "usec");
}
});
});
@@ -32,8 +36,7 @@ function testRequest() {
// Tests the roundtrip time of Port.postMessage() after opening a channel.
function testConnect() {
- var results = document.getElementById("resultsConnect");
- results.innerHTML = "running...";
+ setChildTextNode("resultsConnect", "running...");
chrome.tabs.getSelected(null, function(tab) {
var timer = new chromium.Interval();
@@ -47,7 +50,7 @@ function testConnect() {
} else {
timer.stop();
var usec = Math.round(timer.microseconds() / response.counter);
- results.innerHTML = usec + "usec";
+ setChildTextNode("resultsConnect", usec + "usec");
}
});
});

Powered by Google App Engine
This is Rietveld 408576698