Simplified JavaScript demo code to use textContent instead of manipulating text nodes.

This commit is contained in:
Project Nayuki 2018-06-12 20:11:34 +00:00
parent d0945942a9
commit b5ab7dfb7f
1 changed files with 1 additions and 4 deletions

View File

@ -127,10 +127,7 @@ function redrawQrCode() {
stats += "encoding mode = " + describeSegments(segs) + ", ";
stats += "error correction = level " + "LMQH".charAt(qr.errorCorrectionLevel.ordinal) + ", ";
stats += "data bits = " + qrcodegen.QrSegment.getTotalBits(segs, qr.version) + ".";
var elem = document.getElementById("statistics-output");
while (elem.firstChild != null)
elem.removeChild(elem.firstChild);
elem.appendChild(document.createTextNode(stats));
document.getElementById("statistics-output").textContent = stats;
}