Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fix HTMLCollection iteration to make unhide function work as expected (#4051)

EunChan Park2de7c18569d6
diff --git a/lib/reporters/html.js b/lib/reporters/html.js
index d3f488a9..70e86984 100644
--- a/lib/reporters/html.js
+++ b/lib/reporters/html.js
@@ -357,8 +357,8 @@ function hideSuitesWithout(classname) {
*/
function unhide() {
var els = document.getElementsByClassName('suite hidden');
- for (var i = 0; i < els.length; ++i) {
- els[i].className = els[i].className.replace('suite hidden', 'suite');
+ while (els.length > 0) {
+ els[0].className = els[0].className.replace('suite hidden', 'suite');
}
}