diff --git a/lib/reporters/html.js b/lib/reporters/html.js index 0472e5b733..c32a8f300c 100644 --- a/lib/reporters/html.js +++ b/lib/reporters/html.js @@ -88,9 +88,9 @@ function HTML(runner, options) { } else { // On some broswers, canvas might be unavailable for whatever reason. // As such, we need a text version as a fallback - var progressTextFallback = fragment('0%'); - progressText = stat.getElementsByTagName('em')[0]; - items[0].appendChild(progressTextFallback); + var progressTextFallback = fragment('
  • progress: 0%
  • '); + progressText = progressTextFallback.getElementsByTagName('em')[0]; + items[0].replaceWith(progressTextFallback); } if (!root) { @@ -248,7 +248,7 @@ function HTML(runner, options) { // setting it too high, makes the progress text longer then it needs to // to address this, calculate the toFixed based on the magnitude of total var decmalPlaces = Math.ceil(Math.log10(runner.total/100)); - text(progressText, percent.toFixed(Math.min(Math.max(decmalPlaces), 0), 100)); + text(progressText, percent.toFixed(Math.min(Math.max(decmalPlaces, 0), 100))); } // update stats